Skip to content

fix(jsonforms-renderers): show search labels after a cancelled resolve - #96

Merged
ginaxu1 merged 1 commit into
OpenNSW:mainfrom
WebCooper:fix/jsonforms-renderers-search-select-label
Oct 8, 2026
Merged

ginaxu1 merged 1 commit into
OpenNSW:mainfrom
WebCooper:fix/jsonforms-renderers-search-select-label

Conversation

@WebCooper

@WebCooper WebCooper commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Search-select fields kept the raw stored id when the lookup was cancelled before it finished. The id is marked resolved only after the lookup settles, so a refetched form can show the displayTemplate.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Other (please describe):

Changes Made

  • SearchSelectControl records a stored id as resolved only after resolve finishes, so a cancelled attempt is retried and the display template is applied
  • Adds a StrictMode test that a stored id renders as {name} ({id}) after the first lookup is cancelled

Testing

  • I have tested this change locally
  • I have added tests that prove my fix is effective or that my feature works
  • I have tested edge cases
  • All existing tests pass

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have checked that there are no merge conflicts

Related Issues

N/A

Screenshots/Demo

N/A

Deployment Notes

No change to a running deployment. Portals keep the published package until a new @opennsw/jsonforms-renderers version is released and the dependency is bumped.

Additional Notes

N/A

Summary by CodeRabbit

  • Bug Fixes
    • Improved how search-select fields display saved selections, including when the form runs in Strict Mode. Resolved values now show their templated labels once lookup completes.
    • Selections retain their displayed label when lookup is unavailable or returns no result, and cancelled lookups no longer overwrite the current selection.

…mplate handling and new test case

This update introduces a new test case to verify the displayTemplate functionality for stored IDs, ensuring that the correct label is shown after a resolve is cancelled and retried. Additionally, the SearchSelectControl implementation has been refined to improve label persistence and handling of optimistic UI updates during asynchronous resolution. The changes enhance the robustness and clarity of the dropdown behavior in the component.
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1737e73d-5926-4874-be54-a840f355a6bd
📥 Commits

Reviewing files that changed from the base of the PR and between d0bf312 and 7e8853f.

📒 Files selected for processing (2)
  • packages/jsonforms-renderers/src/renderers/SearchSelectControl.test.tsx
  • packages/jsonforms-renderers/src/renderers/SearchSelectControl.tsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

SearchSelectControl now records resolved values after checking existing labels or waiting for resolution. A new StrictMode test checks that a stored ID resolves to the expected templated label.

Changes

SearchSelect resolution

Layer / File(s) Summary
Resolve effect and StrictMode test
packages/jsonforms-renderers/src/renderers/SearchSelectControl.tsx, packages/jsonforms-renderers/src/renderers/SearchSelectControl.test.tsx
The resolve effect records existing object-mode labels directly and records other values after resolution settles. It skips updates after cancellation. A StrictMode test checks the templated label and resolver input for a stored ID.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: ginaxu1

Merge Risk: ⚪ Minimal · up to 7e885

Search-select fields should now show the templated label instead of a raw stored ID after a cancelled lookup. No merge-blocking risk was identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: showing search labels after a resolve operation is cancelled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@WebCooper
WebCooper marked this pull request as ready for review October 7, 2026 08:17
@WebCooper WebCooper self-assigned this Oct 7, 2026
@ginaxu1
ginaxu1 merged commit c39d889 into OpenNSW:main Oct 8, 2026
3 checks passed
@sthanikan2000 sthanikan2000 added Package/jsonforms-renderers Changes to packages/jsonforms-renderers Type/Bug Something isn't working as expected labels Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Package/jsonforms-renderers Changes to packages/jsonforms-renderers Type/Bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants