Skip to content

[Due for payment 2025-07-22] [$250] Optimize useSearchHighlightAndScroll #65789

@mountiny

Description

@mountiny

coming from here

Background

Bottom tabs are one of the most frequently used and performance-critical areas of the app. Interactions must feel instant to preserve a smooth user experience.

Problem

The useSearchHighlightAndScroll hook runs multiple heavy iterations over entire collections inside a useEffect. Due to a large dependency array, this effect re-runs often - triggering expensive recalculations whenever any of them change. As a result, navigating to or from the Search screen becomes sluggish, especially on larger accounts.

Solution

Optimize collection lookups by replacing .includes with a Set and using .has() for O(1) checks. This change dramatically reduces the cost of useEffect executions.

Measurements of the affected useEffect (Jason’s state):

  • Before: 2.92s
  • After: 56ms
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021943045609459074645
  • Upwork Job ID: 1943045609459074645
  • Last Price Increase: 2025-07-09
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @kadiealexander

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions