Skip to content

[Due for payment 2026-07-13] Migrate TroubleshootPage.tsx from useOptionsList to useFilteredOptions #82184

Description

@mountiny

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:

  1. Remove import {useOptionsList} from '@components/OptionListContextProvider'
  2. Remove the const {resetOptions} = useOptionsList({shouldInitialize: false}) call
  3. Remove the resetOptions() call from the ConfirmModal onConfirm handler (since clearOnyxAndResetApp() already clears Onyx data)
  4. 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 OwnerCurrent Issue Owner: @hoangzinh

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions