-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: search transition smoother on slower devices #31354
perf: search transition smoother on slower devices #31354
Conversation
This memoizes relevant functions and values to not re-render LHNOptionsList and ReportActionsList when there's some update in react tree which is not relevant
I can help if requires C+ review |
Seems like we have a number of conflicts here 😁 |
I think @hurali97 is OOO this week. Maybe move this PR forward next week. |
… perf/search-transition-smoother-on-slower-devices
@situchan conflicts resolved 👍 |
I still see some |
Yeah it might be that when I fixed the previous, some latest changes were merged outside my working hours. I will resolve those as well. |
… perf/search-transition-smoother-on-slower-devices
@Gonals conflicts resolved !! |
@situchan Are you able to review the PR? 🙂 |
yes reviewing today |
… perf/search-transition-smoother-on-slower-devices
… perf/search-transition-smoother-on-slower-devices
@situchan any updates on the review 🙂 |
reviewing now |
Coming from here. Waiting on to fix Reassure Tests. In the mean time, I will keep resolving conflicts so that we don't have huge conflicts at the end, when Reassure tests are fixed and we are following up again on this PR. Thanks. |
… perf/search-transition-smoother-on-slower-devices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! @Gonals Could you please review this one soon? thanks!
@@ -497,4 +497,4 @@ ReportActionsList.propTypes = propTypes; | |||
ReportActionsList.defaultProps = defaultProps; | |||
ReportActionsList.displayName = 'ReportActionsList'; | |||
|
|||
export default compose(withWindowDimensions, withPersonalDetails(), withCurrentUserPersonalDetails)(ReportActionsList); | |||
export default compose(withWindowDimensions, withPersonalDetails(), withCurrentUserPersonalDetails)(memo(ReportActionsList)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this change related to the rest of the PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This goes hand in hand with the following:
we notice that due to isFocused state value in ActionItemView the ReportActionsList re-renders which also adds the overhead to the rendering cycle as it recreates the instances of recordTimeToMeasureItemLayout and loadOlderChats which are passed as props to ReportActionsList
… perf/search-transition-smoother-on-slower-devices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@Gonals looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
As discussed in the PR, Performance tests failing here are not an emergency |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/Gonals in version: 1.4.24-0 🚀
|
[CP Staging] Revert "Merge pull request #31354 from hurali97/perf/search-transitio…
This was reverted as bunch of regressions have been found not related to the search page |
🚀 Deployed to production by https://github.com/thienlnam in version: 1.4.24-3 🚀
|
🚀 Deployed to staging by https://github.com/Gonals in version: 1.4.24-4 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.24-8 🚀
|
Details
When user navigates back from Search Sidebar there’s a noticeable delay and lag in closing the Search Sidebar. It mainly arises from
withNavigationFocus
HOC as it re-renders theBaseOptionSelector
tree includingOptionsList
. Adding amemo
toOptionsList
doesn’t help as it’s parent gets re-rendered due to thewithNavigationFocus
HOC.Also, we notice that due to
isFocused
state value inActionItemView
theReportActionsList
re-renders which also adds the overhead to the rendering cycle as it recreates the instances ofrecordTimeToMeasureItemLayout
andloadOlderChats
which are passed as props toReportActionsList
.We can remove the
withNavigationFocus
HOC and add navigation listeners(focus, blur) inBaseOptionSelector
and memoizeOptionsList
to not re-render when state is set in it’s parent. We can avoid recreating instances ofrecordTimeToMeasureItemLayout
andloadOlderChats
by wrapping them inuseCallbacks
and memoizingReportActionsList
.Before on 6x CPU throttle:
recording-before.mov
profile-ranked-before
profile-timeline-before
After on 6x CPU throttle:
Screen.Recording.2023-11-16.at.12.43.10.PM.mov
profile-ranked-after
profile-timeline-after
Fixed Issues
$ #33596
PROPOSAL: https://expensify.slack.com/archives/C05LX9D6E07/p1699514971219659
Tests
Manual Test:
Click on Search Icon and Search Sidebar should appear quickly
Verify that no errors appear in the JS console
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android-recording.mov
Android: mWeb Chrome
android-web-recording.mov
iOS: Native
ios-recording.mov
iOS: mWeb Safari
ios-web-recording.mov
MacOS: Chrome / Safari
web-recording.mov
MacOS: Desktop
desktop-recording.mov