perf: reduce rerenders of sidebar#12369
Conversation
|
/cc @Julesssss |
When I was working on these components, I found that "experimenting" was the best approach to finding what worked for the behavior prop. The official docs say that it's a best practice to include the behavior prop for both Android and iOS:
https://reactnative.dev/docs/keyboardavoidingview So, I think it might be a mistake to omit the prop entirely. Is there a different behavior, like using "position" or "height" which will fix the problem, and also not lead to a regression on other platforms? Please be sure to carefully test this change on all platforms. |
|
@Santhosh-Sellavel ah yeah great, then let's wait for that to get merged first? Just wondering, if we remove the // EDIT: just seen in the PR's screenshots that's the functionality is preserved, great! |
|
Also added the |
|
@hannojg This can come off hold, please resolve conflicts! |
There was a problem hiding this comment.
Code looks good to me as it is mostly coming from previous PR.
@hannojg @Santhosh-Sellavel Can you please specifically test for this issue #12281 and repro steps mentioned there? thank you very much!
…f/memoize-sidebar-2
|
(conflicts resolved, good to get tested again!) |
| allPolicies: { | ||
| key: ONYXKEYS.COLLECTION.POLICY, | ||
| }, |
There was a problem hiding this comment.
I don't think it should be done in this PR (this PR is already old enough), but I think it would be great to implement the Onyx property selectors here, like was done in sidebarlinks:
https://github.com/Expensify/App/blob/main/src/pages/home/sidebar/SidebarLinks.js#L221-L224
That could really help with performance here.
PR Reviewer Checklist
|
deetergp
left a comment
There was a problem hiding this comment.
Code looks good, but I've got a couple requests:
- Can you be more explicit about the QA steps. Are they the same as the testing steps? If so, then plainly state it.
- Since this hasn't been deployed to staging, then how could you have tested whether or not there were errors in the JS console? Please un-check the QA box.
|
@hannojg There is a Jest Unit test job failing, I tried to restart it but it failed again. I guess this must be related to this PR too |
|
@mountiny hm no, I think that one is failing on the |
|
@hannojg Just came here to say I see it on other PR too, wondering when this started. |
|
There is already a fix on the way. not sure if seen already 😊 #12831 |
|
Nice, yeah so we can merge this once that is merged and Santosh posts the checklist. |
|
#12831 merged, waiting for santosh only 🙌 |
…f/memoize-sidebar-2
…-app-fork into perf/memoize-sidebar-2
|
@Santhosh-Sellavel Lets get this merged today! Great job on this one @hannojg and Santosh for catching the edge cases. |
|
On it |
Reviewer Checklist
Screenshots/VideosDesktop & WebScreen.Recording.2022-11-18.at.11.05.50.PM.movMobile Web - ChromeScreen_Recording_20221118_230116_Chrome.mp4Mobile Web - SafariSimulator.Screen.Recording.-.iPhone.14.-.2022-11-18.at.23.03.05.mp4iOS & AndroidScreen.Recording.2022-11-18.at.10.55.13.PM.mov |
|
@mountiny looks like this was merged without the checklist test passing. Please add a note explaining why this was done and remove the |
|
Well, how to say it Melvin, I think you heard it many times by now. The tests were passing, stop gaslighting me! |
|
🚀 Deployed to production by @luacmartins in version: 1.2.30-0 🚀
|
|
|
||
| componentDidMount() { | ||
| const routes = lodashGet(this.props.navigation.getState(), 'routes', []); | ||
| Welcome.show({routes, showCreateMenu: this.showCreateMenu}); |
There was a problem hiding this comment.
✋ Coming from #20609
The FAB button shows up on the Abracadabra page after opening the main browser tab and going back to the Abracadabra page.
For the fix, we conditionally show the popover only on the CENTRAL_PANE_NAVIGATOR or the home page.
Details
There was this PR for improving the performance by reducing the rerenders of the sidebar, which is a heavy component.
However, this PR introduced a bug where the FAB wouldn't show on android anymore.
This PR includes the previous PR + a fix to make sure it's working on android.
The main solution was to omit the
behaviorprop.This PR also fixed another issue, where on tablets there was a great empty area when opening the keyboard:
Fixed Issues
$ #12119
PROPOSAL: GH_LINK_ISSUE(COMMENT)
Tests
QA Steps
Same as testing steps!
PR Author Checklist
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*filesWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)PR Reviewer Checklist
The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick).src/languages/*filesWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarhave been tested & I retested again)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)Screenshots
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android