-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Create REPORT_METADATA onyx key to separate report loading logic from the report data #26173
Conversation
# Conflicts: # src/pages/home/ReportScreen.js
0a6685c
to
90c9119
Compare
# Conflicts: # src/pages/home/report/ReportActionItem.js
Unit Tests failing |
src/pages/home/ReportScreen.js
Outdated
{/* Note: The ReportActionsSkeletonView should be allowed to mount even if the initial report actions are not loaded. If we prevent rendering the report while they are loading then | ||
we'll unnecessarily unmount the ReportActionsView which will clear the new marker lines initial state. */} | ||
{(!isReportReadyForDisplay || isLoadingInitialReportActions || isLoading) && <ReportActionsSkeletonView containerHeight={skeletonViewContainerHeight} />} |
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.
I think the loader is not really shown now in the app
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.
I think nothing is shown not even the header because of onyx blocking the rendering, not because this conditional changed, but I can double check
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.
Yep, the conditional is correct on the first render of the screen, it just seems that now the actions load so fast that the skeleton is no longer rendered. But we are still working on finding more performance improvements because the screen can be mounted even faster, then the skeleton will probably start working again
Co-authored-by: Vit Horacek <[email protected]>
Co-authored-by: Vit Horacek <[email protected]>
@mountiny we're holding this until merge freeze is over, right? |
Yes while this would be great to have, I think it has higher risk of regression slipping through the testing so I agree |
I'm very sure the last two reported bugs have nothing to do with my changes, but it's up to you @mountiny, I can take a look tomorrow if you feel like this should be fixed as part of this PR. |
The layout glitch is reproducible on |
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.
Let's remove the redundant code and this should be ready to get merged.
src/pages/home/ReportScreen.js
Outdated
@@ -245,6 +253,18 @@ function ReportScreen({ | |||
[route], | |||
); | |||
|
|||
const calculateSkeletonViewHeight = (event) => { |
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 code become redundant after this commit ffaf7a8 , As for the other component that uses skeletonViewContainerHeight
, It's ReportActionsView
, does not have a prop called parentViewHeight
, I bet it was mistakenly added in this PR #12169
Let's just remove it .
App/src/pages/home/ReportScreen.js
Line 366 in ffaf7a8
parentViewHeight={skeletonViewContainerHeight} |
@ospfranco @fedirjh tahnk you very much for a quick work, lets get this ready to get merged |
Redudant code removed :) |
@fedirjh The build should be running for final tests, we are close 🤌 |
@mountiny seems like the build was not triggered ? Should I run the reviewer checklist locally? |
🧪🧪 Use the links below to test this build in android and iOS. Happy testing! 🧪🧪 |
# Conflicts: # src/pages/home/ReportScreen.js
Merged main to resolve conflicts |
@ospfranco I have reproduced this bug #26173 (comment) , on Mac/Chrome and Mobile web/chrome, with 2 different accounts : CleanShot.2023-09-18.at.09.26.09.mp4On native , the report is not displayed immediately : a momentary empty view appearing between the skeleton and the report. This issue is also present on the web, but it's less noticeable due to a quick transition . This behavior seems to stem from the report data being split into two collections, and any updates to each collection trigger a re-render. It's unclear whether we can completely eliminate this issue, but I'd like to hear your thoughts on possible solutions. CleanShot.2023-09-18.at.09.28.36.mp4 |
It's unclear whether this bug is related to the current PR. I was unable to reproduce it locally. It seems more like an issue with the ad-hoc build. |
I also reproduced this on the adhoc build but I am not sure if this is problem with the pr or with the build
This is not looking that great I agree, the updates should be right after each other right, since its successData which is applied and removes the skeleton and then the report data should be shown immediately |
I'm not able to reproduce the issue, however nothing of my changes should affect the behavior after log in
This is rather a problem with the component tree being too slow to render due to all the stuff we already discussed and should be far less noticeable or even not there at all when all the performance improvements have been merged. However, you seem to be running in simulator, performance on a release build should make this less noticeable. |
I already tested the android build and got the same result andro.mp4 |
Let me check if there is anything I can do about it with the current changes |
Added one more conditional to keep the skeleton view mounted while the actions are being layouted. @fedirjh give it a try. |
@ospfranco We have a lint error. Switching between loaded reports briefly displays a skeleton. CleanShot.2023-09-18.at.12.01.38.mp4 |
Ah, yeah, then it doesn't work. The real issue is the mounting speed of the component, everything else is a workaround. If it is really a blocker, then I suggest it is better to close this PR and wait until the onyx one is merged (should be soon), and work on #26772 as it will massively improve performance on the mounting of the list component. |
08b0ce1
to
f74d674
Compare
cc @mountiny, what should be next steps in this case ? |
Alright, I think this would be a step back if we would merge this and on web we would get the skeleton flicker for cached pages too (now it loads instantly). If there is no way around that and we need to wait for the initialValues improvement, then I think lets close this PR and focus on that, I can assign you to that PR as well @fedirjh and double the price to cover for this too |
Alright, closing this |
We are trying to optimize the ReportScreen. There are some re-renders on parent components that cause a cascade of re-renders on the screen and the list of actions. This PR takes care of certain issues:
Explanation of the graph is: The first rows are the flushing of React queue, the following bars are the rendering of the bigger components ReportScreen, ReportActionsView, etc. The last row is the rendering of individual actions in the list.
You can see the entire screen is not flushed while a lot of actions are being re-render over and over again:
After the changes, we have regained some of the actions render cycles, but more importantly the flushing happens a bit faster (navigation mounting), so the screen actually feels smoother when navigating in/out.
ReportScreenContext
was used to manipulate certain lists, and would cause parent components to re-render causing a cascade of cyclic renders. By separating the context we limit the re-renders to the part of the tree that consume the specific contexts and win back some render cycles.here is the react devtools trace, you can see before the change there are at least 7 renders, this is also a parent component, so it triggers a cascade of re-renders on the children. Afer the change this has gone down to 3.
useCallback
on the renderItem function of the action list not updating properly. Also causing a full list re-render. The new implementation uses a simple integer to avoid triggering re-renders when nothing has changed.Here is the trace before and after
You can see a reduction of 2 renders, but again this being a parent component it triggers a re-render of the entire list elements
Before:
After:
You can see the spike created by setting this locale in the DevTools:
Fixed Issues
$ #26087
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)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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.Results
All in all, after all these optimizations here is the navigating in/out of the screen:
CleanShot.2023-08-30.at.13.33.47.mp4