Skip to content

[$250] [Performance] Typing in Inbox search freezes JS thread on mobile #83207

@mountiny

Description

@mountiny

Description

Typing into the Inbox search (SearchRouter) freezes the JS thread on mobile. The native back gesture and native scrolling still work, but all JS-driven interactions (navigation buttons, virtualization recalculation) become unresponsive.

Steps to Reproduce

  1. Open the app on a mobile device (iOS or Android)
  2. Tap the search icon in the Inbox
  3. Start typing a search query
  4. Observe that the UI becomes unresponsive

Expected Behavior

Search input should remain responsive while filtering results, with no perceptible lag or JS thread blocking.

Actual Behavior

The JS thread freezes. Navigation buttons stop working, virtualization bounds don't recalculate. Only native gestures (back swipe, scroll) continue to work.

Root Cause

autocompleteQueryValue in SearchRouter.tsx updates immediately on every keystroke (only textInputValue is debounced). This triggers synchronous re-computation of:

  • getSearchOptions() -- filters all reports/personal details
  • isSearchStringMatch() -- creates RegExp per word per item
  • combineOrderingOfReportsAndPersonalDetails() -- sorts results
  • Multiple .filter() chains on tags, categories, currencies, participants

Suggested Fixes

  1. Debounce autocompleteQueryValue (or the prop passed to SearchAutocompleteList) so filtering doesn't run on every keystroke
  2. Memoize searchOptions and recentReportsOptions with stable dependencies
  3. Optimize isSearchStringMatch -- reuse compiled RegExp objects instead of creating new ones per iteration
  4. Consider moving heavy filtering off the JS thread (InteractionManager, web worker, or native module)

Platform

  • iOS
  • Android
  • Web (likely affected but less severe)

Reporter

Chuck (Slack thread)

Issue OwnerCurrent Issue Owner: @rafaelafonso
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022025920563596911295
  • Upwork Job ID: 2025920563596911295
  • Last Price Increase: 2026-03-02
  • Automatic offers:
    • aimane-chnaif | Reviewer | 110717229

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Status

LOW

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions