Problem
TroubleshootPage.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
This is a special case -- TroubleshootPage.tsx only uses resetOptions from useOptionsList({ shouldInitialize: false }). It does not use options or areOptionsInitialized at all.
Current usage:
- Properties used:
resetOptions only
- Called with:
{ shouldInitialize: false }
- File:
src/pages/settings/Troubleshoot/TroubleshootPage.tsx
How resetOptions is used:
- Called inside the "Clear cache and restart"
ConfirmModal onConfirm handler, alongside clearOnyxAndResetApp()
Migration approach:
Since useFilteredOptions reads directly from Onyx (no shared context cache), and clearOnyxAndResetApp() already clears Onyx, the resetOptions call may be completely unnecessary after the migration. The solution is likely to simply remove the useOptionsList call entirely, since clearing Onyx will naturally reset any options that useFilteredOptions computes from Onyx data.
Migration steps:
- Remove
import {useOptionsList} from '@components/OptionListContextProvider'
- Remove the
const {resetOptions} = useOptionsList({shouldInitialize: false}) call
- Remove the
resetOptions() call from the ConfirmModal onConfirm handler (since clearOnyxAndResetApp() already clears Onyx data)
- Verify the clear cache and restart flow still works correctly
Complexity: Simple (special case)
Reference PR: #74071
Tests
- Verify "Clear cache and restart" flow works correctly from Settings > Troubleshoot
- Verify the app restarts cleanly after cache clear
- Verify options are properly rebuilt on the fresh start
- Verify no errors appear in the JS console
- Test on all platforms (iOS, Android, Web, Desktop)
Issue Owner
Current Issue Owner: @hoangzinh
Problem
TroubleshootPage.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
This is a special case --
TroubleshootPage.tsxonly usesresetOptionsfromuseOptionsList({ shouldInitialize: false }). It does not useoptionsorareOptionsInitializedat all.Current usage:
resetOptionsonly{ shouldInitialize: false }src/pages/settings/Troubleshoot/TroubleshootPage.tsxHow resetOptions is used:
ConfirmModalonConfirmhandler, alongsideclearOnyxAndResetApp()Migration approach:
Since
useFilteredOptionsreads directly from Onyx (no shared context cache), andclearOnyxAndResetApp()already clears Onyx, theresetOptionscall may be completely unnecessary after the migration. The solution is likely to simply remove theuseOptionsListcall entirely, since clearing Onyx will naturally reset any options thatuseFilteredOptionscomputes from Onyx data.Migration steps:
import {useOptionsList} from '@components/OptionListContextProvider'const {resetOptions} = useOptionsList({shouldInitialize: false})callresetOptions()call from the ConfirmModal onConfirm handler (sinceclearOnyxAndResetApp()already clears Onyx data)Complexity: Simple (special case)
Reference PR: #74071
Tests
Issue Owner
Current Issue Owner: @hoangzinh