-
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
Delay report history fetch to give app a chance to initialize #2519
Conversation
Give personalDetails default to prevent breaking on sign in Reorganize initial API calls a bit fix comment
c501d49
to
fb44a6f
Compare
@@ -119,7 +119,7 @@ class AuthScreens extends React.Component { | |||
PersonalDetails.fetch(); | |||
User.getUserDetails(); | |||
User.getBetas(); | |||
fetchAllReports(true, true); | |||
fetchAllReports(true, true, 8000); |
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 number tests well now, but we might need to revisit in the future, perhaps a constant could be used to provide a bit more context?
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.
+1
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.
Yeah, I sort of just hate that this is an arbitrary delay, but not sure what else to do. We could separate the fetching of history from fetchAllReports
and then call it on it's own based on some other event.... but still not quite sure what that event would be.
Rather than make a constant I'll bake this into the method and add more context there since I feel like there's a chance this will change in the future and isn't really the best solution - but works for today.
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.
While definitely an improvement, 8 seconds is quite the magic number.
This seems to suggest that the overhead of multiple requests does have an effect of the performance. Doe you think that is the case, or is there more to it? (perhaps rendering is also contributing to the problem)
@@ -119,7 +119,7 @@ class AuthScreens extends React.Component { | |||
PersonalDetails.fetch(); | |||
User.getUserDetails(); | |||
User.getBetas(); | |||
fetchAllReports(true, true); | |||
fetchAllReports(true, true, 8000); |
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.
+1
Right, so the real culprit in this case is actually that the
I guess another solution here would be to change this up so that we don't post-process the report history all at once and instead use a |
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 the best solution we have for the moment 👍
✋ 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 production in version: 1.0.39-5🚀
|
Details
When a user first signs in we are fetching all of their report history for all reports right away before the app is even interactive. This is causing massive numbers of network requests and data processing that prevent the app from loading fast.
This approximately cuts the time it takes to reach the fully loaded sidebar on Android in half.
Fixed Issues
Fixes https://github.com/Expensify/Expensify/issues/160975
Fixes #2278
Tests
The test I performed was to drop a console.log() here and here:
OptionRow
render in theSidebarLinks
which tends to correspond with whether or not it is visible.main
and go the following resultsmain
11 seconds
this branch
5.3 seconds
QA Steps
No QA besides regressions
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android