-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
Description
Problem
SearchRouter.tsx currently uses the useOptionsList hook from OptionListContextProvider, which causes unnecessary background recalculations on every personal details or reports change.
This is part of a larger effort to remove OptionListContextProvider entirely. See parent issue #82193 for full context.
Solution
Replace useOptionsList with useFilteredOptions following the pattern established in PR #74071 (NewChatPage migration).
Current usage:
- Properties used:
areOptionsInitializedonly - Called with: no arguments
- File:
src/components/Search/SearchRouter/SearchRouter.tsx
How areOptionsInitialized is used:
- Combined with
isRecentSearchesDataLoadedintoshouldShowListflag - Controls conditional rendering: shows
SearchAutocompleteListwhen true, showsOptionsListSkeletonViewwhen false
Migration steps:
- Replace
import {useOptionsList} from '@components/OptionListContextProvider'withimport useFilteredOptions from '@hooks/useFilteredOptions' - Replace
useOptionsList()call withuseFilteredOptions({ enabled: true }) - Replace
areOptionsInitializedwith!isLoadingin theshouldShowListcomputation - The rest of the conditional rendering logic should work as-is
Note: This component only uses areOptionsInitialized for gating visibility. The actual options data is consumed by SearchAutocompleteList (a separate migration issue). These two migrations are independent.
Complexity: Simple
Reference PR: #74071
Tests
- Verify the search router opens and shows the autocomplete list correctly
- Verify the skeleton loading view shows while options are being computed
- Verify search functionality works end-to-end
- Verify no errors appear in the JS console
- Test on all platforms (iOS, Android, Web, Desktop)
Reactions are currently unavailable