fix: LookupField shows no visual feedback after RecordPickerDialog selection#1095
Merged
fix: LookupField shows no visual feedback after RecordPickerDialog selection#1095
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…Dialog selection Add `onSelectRecords` callback to RecordPickerDialogProps that returns full record objects alongside IDs. LookupField caches these records so findOption can resolve display labels after the dialog closes. Handles both single-select and multi-select modes. Multi-select uses a selectedRecordsMap ref to persist record data across page navigation. Includes 4 new tests validating the end-to-end selection display flow. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix lookup field popup selection feedback
fix: LookupField shows no visual feedback after RecordPickerDialog selection
Mar 19, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a LookupField UX bug where selecting records via the Level 2 RecordPickerDialog updates the underlying value but doesn’t update the LookupField’s visible label/badges, by returning full record objects from the picker and caching them for display.
Changes:
- Added optional
onSelectRecords(records)callback toRecordPickerDialogand aselectedRecordsMapcache to retain selected record objects across paging (multi-select). - Added
pickerResolvedRecordscache inLookupFieldand updatedfindOptionto also resolve display data from dialog-selected records. - Added tests for
onSelectRecordsbehavior and for LookupField badge rendering after Level 2 selection; updated CHANGELOG.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/fields/src/widgets/RecordPickerDialog.tsx | Adds onSelectRecords callback and caches selected record objects for multi-select paging. |
| packages/fields/src/widgets/LookupField.tsx | Caches dialog-selected records and extends option resolution to show badges/labels after dialog selection. |
| packages/fields/src/record-picker.test.tsx | Adds tests for onSelectRecords and end-to-end LookupField display after dialog selection. |
| CHANGELOG.md | Documents the LookupField selection display fix and the new callback. |
Comment on lines
+311
to
+314
| const mapped = records.map(r => recordToOption(r, displayField, idField, descriptionField)); | ||
| setPickerResolvedRecords(mapped); | ||
| }, | ||
| [displayField, idField, descriptionField], |
| ]), | ||
| ); | ||
| expect(onOpenChange).toHaveBeenCalledWith(false); | ||
| }); |
Comment on lines
605
to
+612
| const handleConfirm = useCallback(() => { | ||
| onSelect(Array.from(pendingSelection)); | ||
| const ids = Array.from(pendingSelection); | ||
| onSelect(ids); | ||
| // Build the full record array from the cache for the caller | ||
| const selectedRecords = ids | ||
| .map(id => selectedRecordsMap.current.get(id)) | ||
| .filter(Boolean); | ||
| onSelectRecords?.(selectedRecords); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Selecting a record in the RecordPickerDialog (Level 2) updates the form value but the LookupField UI shows nothing — no badge, no label. Affects both single and multi-select.
Root cause:
findOptiononly searchesstaticOptionsandfetchedOptions(Level 1 popover). Records loaded by the dialog's own fetch are invisible to the parent.Changes
RecordPickerDialog: New optionalonSelectRecordscallback returns full record objects alongside IDs. AselectedRecordsMapref persists record data across page navigation for multi-select.LookupField: NewpickerResolvedRecordsstate caches records from the dialog.findOptionchecks this as a third fallback source.Tests
4 new tests covering
onSelectRecordsfor single/multi-select and end-to-end LookupField badge rendering after dialog selection.Original prompt
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.