Skip to content

[HOLD for payment 2023-12-29] [HOLD for payment 2023-11-13] [$500] Optimize SearchPage component to reduce lags when opening #30261

@mountiny

Description

@mountiny

Coming from here

Proposal: Optimize SearchPage component to reduce lags when opening

Problem: When opening the SearchPage component using search icon or cmd+k shortcut on web, the animation is pretty laggy. This is caused mostly by OptionsListUtils.getSearchOptions which takes all reports as a param and at some point it processes it by looping through all the elements. For an account with ~15k reports, this loop takes up to 500ms. What’s worth noticing, OptionsListUtils.getSearchOptions is called directly in SearchPage constructor, and it’s responsible for retrieving the data that gets set as an initial state values.

Solution: To prevent doing heavy calculations on the same time as transitioning, we should remove calling getSearchOptions from constructor and set default values to empty objects. Instead, we can load this data right after transition ends by using onEntryTransitionEnd prop in ScreenWrapper. With this solution, animation will be smooth and user will be presented with the skeleton unless the data is processed. In my measurements, it reduced the time for initial render of SearchPage from ~1400ms to ~76ms. While profiling, JS Heap went down from 435-840mb range to 90-450mb.

cc @TMisiukiewicz

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017fbfc71ea6da3266
  • Upwork Job ID: 1716834699820085248
  • Last Price Increase: 2023-10-24

Metadata

Metadata

Labels

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

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions