feat(website, config): add an option for search presets#6136
feat(website, config): add an option for search presets#6136anna-parker wants to merge 7 commits intocustomDisplayReferencefrom
Conversation
|
Claude finished @anna-parker's task in 4m 17s —— View job Code Review
The implementation looks solid overall — the preset logic is well thought out, particularly the multi-select consensus check (only apply a preset if all selected options agree on the value). Good test coverage for the multi-select case. A few issues worth addressing: IssuesDuplicate type definition Missing tests for Stale preset state after page refresh Minor observations
|
website/src/components/SearchPage/fields/MultiChoiceAutoCompleteField.tsx
Outdated
Show resolved
Hide resolved
| const inputRef = useRef<HTMLInputElement>(null); | ||
| const [query, setQuery] = useState(''); | ||
| const [isFocused, setIsFocused] = useState(false); | ||
| const lastPresetKeysRef = useRef<string[]>([]); |
There was a problem hiding this comment.
The lastPresetKeysRef tracking is in-memory only. If a user refreshes the page, the URL still contains the preset-applied field values, but lastPresetKeysRef.current will be empty. Changing or clearing the triggering field after a refresh won't clean up those preset values.
This is a known limitation of using a ref for this kind of ephemeral state, but worth noting as a known edge case since the behaviour can seem surprising (stale filter values persist until manually cleared after a page reload).
There was a problem hiding this comment.
I'm not sure if there is a better way to handle this, @theosanderson do you have any better ideas?
website/src/components/SearchPage/fields/MultiChoiceAutoCompleteField.spec.tsx
Show resolved
Hide resolved
b871764 to
2844593
Compare
2844593 to
3b31130
Compare
resolves #5904
Screenshot
PR Checklist
🚀 Preview: Add
previewlabel to enable