perf: navigate before optimistic writes in Search onSelectRow#87982
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@mananjadhav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required on this one.
|
@mananjadhav are you available to review this one please? |
|
I reviewed the code change. I am going to test this and do a regression test by today. |
|
@mananjadhav hello! any updates on this one? |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid-transaction-list-item.movAndroid: mWeb Chromemweb-chrome-transaction-list-item.moviOS: HybridAppios-transaction-list-item.moviOS: mWeb Safarimweb-safari-transaction-list-item.movMacOS: Chrome / Safariweb-transaction-list-item.mov |
mananjadhav
left a comment
There was a problem hiding this comment.
I reviewed these changes and tested to ensure nothing breaks. From performance point of view I could see very little improvement overall. I didn't track the frames tbh.
Should be good to merge though.
|
🚧 @rlinoz has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Explanation of Change
When pressing a
TransactionListItemin Search results, the app ran synchronous Onyx writes and React state updates before deferring navigation withrequestAnimationFrame. This caused blocking work (derived value recomputations, subscriber notifications) before navigation even started.This PR reorders the flow: navigate immediately, then run optimistic data setup. React
setStatecalls are wrapped instartTransitionso their re-renders are treated as low-priority by React's scheduler.Changes across all 3 navigation paths in
onSelectRow:markReportIDAsExpenseviastartTransition, Onyx writes run afterstartTransition, Onyx writes run afterrequestAnimationFramewrapperProfiler results (4 before trials, 3 after trials):
My workflow was to open the same report from search and wait until it settles in the RHP.
Fixed Issues
$ #87990
Tests
Offline tests
QA Steps
Same as Tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari