Skip to content

[Tracking] Remove OptionListContextProvider and migrate all consumers to useFilteredOptions #82193

@mountiny

Description

@mountiny

Problem

OptionListContextProvider recalculates options in the background on every personal details or reports change, causing lag across the app. PR #74071 demonstrated a better pattern using useFilteredOptions, which only computes options when a screen is mounted and visible.

Key benefits of useFilteredOptions over OptionListContextProvider:

  • No background recalculations -- options are only computed when the screen is mounted/enabled
  • Smart pre-filtering -- sorts reports by lastVisibleActionCreated and limits to top N (default 500)
  • Pagination support -- loadMore / hasMore for incremental loading
  • Per-screen control -- each consumer manages its own lifecycle via enabled config

Solution

Migrate all remaining consumers of useOptionsList to useFilteredOptions, then remove the OptionListContextProvider entirely.

Migration Pattern

Follow the approach from PR #74071 (NewChatPage migration):

  1. Replace useOptionsList() with useFilteredOptions({ enabled: didScreenTransitionEnd, ... })
  2. Replace areOptionsInitialized checks with isLoading from useFilteredOptions
  3. Replace options usage -- output is now OptionList | null (null when loading)
  4. Remove any shouldInitialize logic (replaced by enabled config)
  5. Test the full user flow on all platforms

Sub-Issues

Phase 1 -- Simple migrations (good for community contributors)

Phase 2 -- Medium migrations

Phase 3 -- High-impact shared hook

Phase 4 -- Final cleanup (depends on all above)

Notes

Issue OwnerCurrent Issue Owner: @mountiny

Metadata

Metadata

Labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions