Problem
ShareTab.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: no arguments (defaults to
shouldInitialize: true)
- File:
src/pages/Share/ShareTab.tsx
How options are used:
options is passed to getSearchOptions() to build searchOptions
areOptionsInitialized gates searchOptions computation and showLoadingPlaceholder
areOptionsInitialized controls whether styledRecentReports are shown in list data
Migration steps:
- Replace
import {useOptionsList} from '@components/OptionListContextProvider' with import useFilteredOptions from '@hooks/useFilteredOptions'
- Replace
useOptionsList() call with useFilteredOptions({ enabled: true }) (or tie to screen transition if applicable)
- Replace
areOptionsInitialized checks with !isLoading (or options !== null)
- Update
showLoadingPlaceholder and list data guards accordingly
Complexity: Simple
Reference PR: #74071
Tests
- Verify the Share tab displays correctly and lists appear without lag
- Verify loading placeholders show correctly while options compute
- Verify search functionality works within the Share tab
- Verify no errors appear in the JS console
- Test on all platforms (iOS, Android, Web, Desktop)
Issue Owner
Current Issue Owner: @mallenexpensify
Problem
ShareTab.tsxcurrently uses theuseOptionsListhook fromOptionListContextProvider, which causes unnecessary background recalculations on every personal details or reports change.This is part of a larger effort to remove
OptionListContextProviderentirely. See parent issue #82193 for full context.Solution
Replace
useOptionsListwithuseFilteredOptionsfollowing the pattern established in PR #74071 (NewChatPage migration).Current usage:
options,areOptionsInitializedshouldInitialize: true)src/pages/Share/ShareTab.tsxHow options are used:
optionsis passed togetSearchOptions()to buildsearchOptionsareOptionsInitializedgatessearchOptionscomputation andshowLoadingPlaceholderareOptionsInitializedcontrols whetherstyledRecentReportsare shown in list dataMigration steps:
import {useOptionsList} from '@components/OptionListContextProvider'withimport useFilteredOptions from '@hooks/useFilteredOptions'useOptionsList()call withuseFilteredOptions({ enabled: true })(or tie to screen transition if applicable)areOptionsInitializedchecks with!isLoading(oroptions !== null)showLoadingPlaceholderand list data guards accordinglyComplexity: Simple
Reference PR: #74071
Tests
Issue Owner
Current Issue Owner: @mallenexpensify