-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Labels
Description
Problem
SearchFiltersChatsSelector.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:
options,areOptionsInitialized - Called with:
{ shouldInitialize: didScreenTransitionEnd } - File:
src/components/Search/SearchFiltersChatsSelector.tsx
How options are used:
optionsis fed intogetSearchOptions()to builddefaultOptionswhen initialized and screen transition has ended- Output of
getSearchOptionsis used infilterAndOrderOptions()forchatOptions areOptionsInitializedguardsdefaultOptions(falls back todefaultListOptionsotherwise)areOptionsInitializedguards section buildingareOptionsInitializedis part ofshowLoadingPlaceholdercomputation
Migration steps:
- Replace
import {useOptionsList} from '@components/OptionListContextProvider'withimport useFilteredOptions from '@hooks/useFilteredOptions' - Replace
useOptionsList({ shouldInitialize: didScreenTransitionEnd })withuseFilteredOptions({ enabled: didScreenTransitionEnd }) - Replace
areOptionsInitializedwith!isLoading(oroptions !== null) - Update
defaultOptions, section building, andshowLoadingPlaceholderguards accordingly
Complexity: Medium
Reference PR: #74071
Tests
- Verify the search filters chats selector works correctly
- Verify chat filtering and selection works within search filters
- Verify loading placeholders show correctly while options compute
- Verify the screen transition delay is properly handled
- Verify no errors appear in the JS console
- Test on all platforms (iOS, Android, Web, Desktop)
Issue Owner
Current Issue Owner: @hoangzinhReactions are currently unavailable