-
Notifications
You must be signed in to change notification settings - Fork 3k
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: recalculate getOrderedReportIDs only on web and desktop #46276
perf: recalculate getOrderedReportIDs only on web and desktop #46276
Conversation
Reviewer Checklist
Screenshots/VideosAndroid: NativeuseReportIDsAndroid.mp4Android: mWeb ChromeuseReportIDsAndroidmWeb.mp4iOS: mWeb SafariuseReportIDsiOSmWeb.mp4MacOS: Chrome / SafariuseReportIDsChrome.mp4useReportIDsChrome1.mp4MacOS: DesktopuseReportIDsDesktop.mp4 |
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.
LGTM!
We did not find an internal engineer to review this PR, trying to assign a random engineer to #46291 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
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.
Seems worth a shot! I have two quick questions but approved:
- Why do we need to also run this if
orderedReportIDs
is empty? shouldUseNarrowLayout
would also be true if the web / desktop windows are narrow enough (I think) - do we need to worry about the case where someone hits this code and then makes the window bigger? Seems relatively uncommon but possible
@dangrous Good point. However, I think this won't be an issue. The reason is that we are mostly trying to improve the performance on mobile devices, so it means mobile web or mobile app. The layout there only shows one screen or one part of UI at a time. If some user narrows the layout on desktop this |
Okay cool, yeah I think this is worth merging, and will do so (after writing this comment). I do want to call out for the future, after the discussion above, the edge case - which is not worth blocking at the moment - where:
So if we can figure out a way to fix that as a follow up maybe? |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
I see the expense showing up on LHN here on expanding the window. enlargeScreen1.mp4enlargeScreen2.mp4When we expand the window to a size above mobile size |
Backlinking to #45528 |
ooh okay i misunderstood the flow then - if that works then I think we're good! |
🚀 Deployed to staging by https://github.com/dangrous in version: 9.0.15-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.0.15-9 🚀
|
Details
This change limits re-calculating
getOrderedReportIDs
on mobile. Which means that this will only be called on web and desktop. Consider a case, where we open a report with expenses, when we click on a expense a new LHN item is added in the LHN list and we are navigated to that new item, when we navigate back OR away from that new item it is then gone. Whereas on mobile, we are just navigated to the next screen with expense details, so there's no LHN being visible, so there seems no point in re-calculating this expensive function on mobile.Before:
After:
So if we average out before it is 118.28ms and after is 44.8ms, so we save around 60% for the case described above.
Fixed Issues
$ #46291
PROPOSAL:
Tests
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 methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
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.mov
Android: mWeb Chrome
android-web.mov
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov