-
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
[Performance] Refactor SidebarLinks
to not use getDerivedStateFromProps()
and other static methods
#7948
Comments
getDerivedStateFromProps()
and other static methodsSidebarLinks
to not use getDerivedStateFromProps()
and other static methods
Taking up your offer on letting me steal this :) |
There is one more component that uses it. But I think it is needed there. The popover render function is expensive for EmojiPicker and using it prevents render until we are fully ready. I don't exactly remember why I used it there but there was a race condition that I was trying to overcome. |
Thanks @parasharrajat. This issue is just for |
Ok. Great. |
Punting |
@marcaaron, this Monthly task hasn't been acted upon in 6 weeks; closing. If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead. |
Work is coming along here nicely. Getting a lot of unit tests written |
Added this App issue to the WhatsApp Quality project to keep track of it. |
Got the first PR done which optimizes some of the current code which figures out the order reports should be displayed in. My second PR refactors the sidebar to render items more efficiently. |
The last PR is in final stages of review and testing. It should merge this week! |
SidebarLinks
to not use getDerivedStateFromProps()
and other static methodsSidebarLinks
to not use getDerivedStateFromProps()
and other static methods
This is all done |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Coming from https://github.com/Expensify/App/pull/7907/files#r816376801
Code cleanup
The file here seems to be following some practices that we should avoid because they are very uncommon in this codebase:
App/src/pages/home/sidebar/SidebarLinks.js
Lines 165 to 174 in 00805b2
There are some well documented reasons why we should use this and not here:
https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html
And it looks like we just want to perform a side effect where when various props change we update the reports we display in the sidebar. But for some reason have used derived state to do this instead of something like
componentDidUpdate()
.Finding this component pretty hard to understand in general...
Solution
componentDidUpdate()
The text was updated successfully, but these errors were encountered: