Skip to content

[HOLD for payment 2024-09-11] [$250] Opening a report from Search panel is not smooth #47724

Description

@kacper-mikolajczak

Problem

Transition between Search panel and a Report screen is not smooth. After user selects a report, it causes:

[iOS] Long rendering process (~270ms) [Web] Noticeable jittering of animation
open-report-from-finder.with-timing.baseline.ios.mov
open-report-from-finder.baseline.web.mov

We would like to have app as responsive to user input as possible, while currently it creates a noticeable delay or jittering.

Testing setup:

Reproduction steps:

  1. Open Search panel (aka ChatFinder)
  2. Search for empty report
  3. Wait until network request finishes (spinner is gone)
  4. Open empty report

Solution

Initial investigations show that the potential villain is a piece of selectReport callback in ChatFinderPage component:

updateSearchValue('');
Navigation.dismissModal(option.reportID);

The dismissModal helper calls originalDismissModalWithReport, which in turn calls getStateFromPath.

On a regular HT account, single call to getStateFromPath takes about 20ms to complete on the web and about 40ms to complete on iOS.

The getStateFromPath internally calls original getStateFromPath implementation from React Navigation, which is quite complex. It may lead to extensive computation resulting in low performance.

The Navigation.dimissModal is called many time across the codebase (75 usages in 52 files).

The implementation of this proposal would aim to improve dimissModal performance (also targeting additional improvements like reduction of unnecessary re-renders).

Potential gains (defining an upper-bound)

In order to prove it is indeed responsible for low-quality performance during transition, dimissModal was replaced with regular call to navigate method and unnecessary updateSearchValue call was removed entirely:

Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(option.reportID));

Keep in mind, this change is not a ready solution (it changes how navigation works) and is here to define how much we could gain after implementing actual solution.

The results of proposed change are as follows:

[iOS] Rendering time reduced by ~15% [Web] No jittery animation
open-report-from-finder.with-timing.upperbound.ios.mov
open-report-from-finder.upperbound.web.mov

Profiling web application shows promising results:

  • ~1050ms time of scripting reduced to ~400ms (~60% reduction)
  • big chunk of RAM was released (possibly GC - further measurements are needed to prove)
[Web] Before [Web] After
open-report-from-finder baseline js web )open-report-from-finder upperbound js web

PR with changes: #47726

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021833637723306135397
  • Upwork Job ID: 1833637723306135397
  • Last Price Increase: 2024-09-10
  • Automatic offers:
    • DylanDylann | Contributor | 103906105
Issue OwnerCurrent Issue Owner: @anmurali

Metadata

Metadata

Labels

AutoAssignerNewDotQualityUsed to assign quality issues to engineersAwaiting 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

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions