Repository navigation
fix(PowerSearch): replace an open value menu when the field or operator changes - #6357
Merged
Merged
Conversation
…or changes Switching the field selector while a value Tokenizer's menu is open left the previous field's suggestions showing. Two fields with the same value type (two `enum_list` fields, say) were rendered through one unkeyed PowerSearchValueEditor, so React reused the editor instance and the Tokenizer's open menu, query, and fetched results all survived the switch. Key the value editor on the (field, operator) pair it edits so it remounts when either changes. The mount-time focus handoff moves into the keyed cell, so the freshly mounted editor is focused and bootstraps its own suggestions whether the popover just opened or the user just picked a different field. Nested sub-filter rows get the same key. BaseTypeahead also advances its search generation when `searchSource` is replaced, so a late response from the old source can no longer populate a menu that now reads a different source.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
September 17, 2026 14:50
Contributor
|
AI review status for this pull request.
|
Contributor
PR Analysis Report
Modified ComponentsPowerSearch (@astryxdesign/core)
Bundle Size Summary
Accessibility AuditStatus: 36 accessibility violation(s) found — 2 critical, 34 serious. Button pattern - 1 issue(s)
ChatComposer - 1 issue(s)
ChatComposerInput - 1 issue(s)
ChatReasoning - 1 issue(s)
ChatToolCalls - 1 issue(s)
Checkbox pattern - 1 issue(s)
CheckboxList - 1 issue(s)
ClickableCard - 1 issue(s)
CodeEditor - 1 issue(s)
CodeEditorPerf - 1 issue(s)
CodeEditorTheme - 1 issue(s)
CodeTheme - 1 issue(s)
DateRangeInput - 1 issue(s)
FileInput - 1 issue(s)
GridMasonry - 1 issue(s)
Heading - 1 issue(s)
Icon - 1 issue(s)
LogStream - 1 issue(s)
MediaTheme Auto - 1 issue(s)
PowerSearch - 1 issue(s)
ProgressBar - 1 issue(s)
Radio group pattern - 1 issue(s)
RadioList - 1 issue(s)
RichTextEditor - 2 issue(s)
SelectableCard - 1 issue(s)
Stepper - 1 issue(s)
TableGroupedRows - 1 issue(s)
TableTree - 1 issue(s)
Text - 1 issue(s)
Theme - 1 issue(s)
PopArt - 1 issue(s)
Thumbnail - 1 issue(s)
Timestamp - 1 issue(s)
Token - 1 issue(s)
Tokenizer - 1 issue(s)
Visual RegressionStatus: No visual change across 4 compared shot(s). Generated by PR Enrichment workflow | View full report |
nynexman4464
marked this pull request as ready for review
September 18, 2026 16:36
nynexman4464
requested review from
cixzhang,
imdreamrunner and
josephfarina
as code owners
September 18, 2026 16:36
Merged
4 tasks done
nynexman4464
added a commit
that referenced
this pull request
Sep 18, 2026
…, not in an effect (#6370) * refactor(Typeahead): invalidate a replaced searchSource during render, not in an effect Follow-up to #6357. A source swap is a fact of the render that carries it, so compare against the previous source there: cancel it, adopt the new one, and advance the search generation. The effect that did this on cleanup — and the lint suppression it needed to read a live ref — go away; what remains is a pure unmount cleanup for the debounce timer and the current source. Also trims the PowerSearchEditPopover comments added in #6357 to the non-obvious "why". * chore: plain-language changelog for the PowerSearch value-menu fix * chore: comments say why, not how
3 tasks done
cixzhang
added a commit
that referenced
this pull request
Sep 19, 2026
This branch was successfully deployed
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.
User impact
Anyone editing a PowerSearch filter whose value editor is a Tokenizer (
enum_list,entity_list,string_list). With the "Select values" menu open, changing the field selector (e.g. Creator → Owner) or the operator leaves the previous field's options in the open menu. Reopening the menu shows the right options; only the already-open menu goes stale. Display-only — an applied filter computes against the right field — but a user picking from the stale list gets a filter that matches nothing. Reproduces on stock field types with no custom editors, and on nested sub-filter rows.Problem and solution fit
PowerSearchEditPopoverrenders one unkeyedPowerSearchValueEditor. When the old and new fields share a value type, React reuses the editor instance, so theTokenizer— and theBaseTypeaheadunder it — keeps its open menu, query text and fetchedresultsacross thesearchSourceswap.PowerSearchFilterEditor's existingkey={filter.field}doesn't help: it responds to the outerfilterprop, which doesn't change until Apply; the field switch is privatepartialFilterstate inside the popover.handleFieldChangeclears the value); the stale menu contradicts the state the user can see in the field chip.The fix gives the value editor the identity it semantically has — the
(field, operator)pair it edits — so React discards the old editor rather than reconciling it. That is the same approachTokenizer/Typeaheadconsumers are expected to take, and matches the "editor identity follows the operator" pattern used by the internal predecessor.Expected behavior and authority
PowerSearchEditPopover.handleFieldChange/handleOperatorChangealready define the intent: field or operator change resets the value.BaseTypeahead.spec.mdFR3 / PR1 (draft): one generation counter rejects stale asynchronous work; this PR adds source replacement to the list of invalidation triggers so the spec and the code agree.Smallest restoration
PowerSearchEditPopover— the value editor is rendered asValueEditorCellkeyed onvalueEditorKey(partialFilter)(field+operator). The mount-time focus handoff moves into that cell rather than living on the popover, so "mount" covers both the popover opening and a field/operator switch: the freshly mounted editor is focused and bootstraps its own suggestions. Nested sub-filter rows key their editor the same way (they have no focus handoff today and none is added).BaseTypeahead— the existing[searchSource]cleanup effect (which already clears the debounce and callscancel?.()) also advancessearchGenRef, so a response from a source that has since been replaced fails the generation check instead of committing.Deliberately not done here:
searchSourceidentity change:Tokenizerrebuilds its filtered source on everyvaluechange by design, so a warning would fire on every token add.handleOperatorChange's keep-value rule (it comparesvalue.typeonly; stricter option-set compatibility is a separate behavior change).Evidence
PowerSearchEditPopover.test.tsx › value editor identity follows the field and operator— both tests fail onmain(theCreator Personoption is still in the document after switching to Owner);Typeahead.test.tsx › discards a response from a source that was replaced while it was in flightfails onmain(the lateAppleresult renders).Creator Personis gone andOwner Personappears without any further interaction; the stale response is discarded and a search against the new source still lands.edit popover resets state when switching between filter tokensand the rest of the PowerSearch / Typeahead / Tokenizer suites are unchanged and green (390 tests across the three directories).Scope
Testing
Behavior under test is DOM/state, not layout or pixels, so jsdom coverage is sufficient; no real-browser states depend on this change.