Skip to content

Migrate SearchFiltersParticipantsSelector.tsx from useOptionsList to useFilteredOptions #82189

@mountiny

Description

@mountiny

Problem

SearchFiltersParticipantsSelector.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/SearchFiltersParticipantsSelector.tsx

How options are used:

  • options.reports and options.personalDetails are passed to getValidOptions() to build participant options
  • Output flows into defaultOptions and then filterAndOrderOptions
  • areOptionsInitialized guards defaultOptions computation
  • areOptionsInitialized guards sections/headerMessage useMemo
  • areOptionsInitialized is part of showLoadingPlaceholder computation

Migration steps:

  1. Replace import {useOptionsList} from '@components/OptionListContextProvider' with import useFilteredOptions from '@hooks/useFilteredOptions'
  2. Replace useOptionsList({ shouldInitialize: didScreenTransitionEnd }) with useFilteredOptions({ enabled: didScreenTransitionEnd })
  3. Replace areOptionsInitialized with !isLoading (or options !== null)
  4. Update defaultOptions, sections/headerMessage, and showLoadingPlaceholder guards accordingly
  5. Handle the null options case in getValidOptions() call

Complexity: Medium

Reference PR: #74071

Tests

  • Verify the search filters participants selector works correctly
  • Verify participant 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 OwnerCurrent Issue Owner: @shubham1206agra

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions