-
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
[HOLD for payment 2024-12-09] [$250] [Performance] BottomTabBar improve state using Initializer function #53162
Comments
Current assignee @mountiny is eligible for the AutoAssignerNewDotQuality assigner, not assigning anyone new. |
@mountiny PR created |
$250 to @eVoloshchak |
Triggered auto assignment to @trjExpensify ( |
Job added to Upwork: https://www.upwork.com/jobs/~021862478694382529016 |
Current assignee @eVoloshchak is eligible for the External assigner, not assigning anyone new. |
Not sure why an offer wasn't sent to @eVoloshchak there. 🤔 |
I've created one more issue where I am going to prevent such problems across the entire project - #53322. Also, I am working on a new Eslint rule - Expensify/eslint-config-expensify#138. |
Nice thank you! |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.69-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-12-09. 🎊 For reference, here are some details about the assignees on this issue:
|
@eVoloshchak @trjExpensify @eVoloshchak The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
@trjExpensify, that's because I request payments via NewDot, all good |
Ah cool, got it! |
@eVoloshchak can you please complete the checklist? |
Payment Summary
BugZero Checklist (@trjExpensify)
|
Can we get the checklist here, please? Thanks! |
|
Sounds good to me, thanks! Confirming payment summary as follows:
Go ahead and request! |
$250 approved for @eVoloshchak |
Problem
The BottomTabBar component initializes one of its states using the getChatTabBrickRoad function. This function is being called directly within the useState hook, which means it gets executed on every render, even though it only needs to run during the initial state setup.
Current implementation:
This approach causes unnecessary re-execution of getChatTabBrickRoad on every render, leading to performance overhead.
Solution
We can pass getChatTabBrickRoad as an initializer function to the useState hook instead. This ensures the function is only executed once during the initial render, improving performance:
Updated implementation:
By making this change, the component avoids unnecessary re-execution of getChatTabBrickRoad on every render. This optimization reduces the render time from approximately ±500ms to just 50-100ms, resulting in a more than 5x performance improvement.
Before
After
Issue Owner
Current Issue Owner: @Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @trjExpensifyThe text was updated successfully, but these errors were encountered: