-
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
[$250] [HOLD for payment 2024-11-13] Fix performance tests failing when migrating to useOnyx()
#51562
Comments
@blazejkustra or @fabioh8010 which one of you two would like to work on this? |
I can look into this 👀 |
@lakchote Do you need a C+ here? If needed, I can help as I have the context. |
Triggered auto assignment to @sakluger ( |
@rojiphil yes I'm assigning you as the C+ reviewer, as you have context on the underlying issue. |
Update: I started investigating yesterday (WIP PR). It looks like the only hook that increases re-renders is the modal one: const [modal] = useOnyx(ONYXKEYS.MODAL); I tried moving this hook to a wrapper, checking if value is loaded but always with the same result - more renders and failing perf tests. That's why I started digging deeper in For now my findings are that modal hook make the component re-render even when value is left unchanged. This is the reason why we see this weird pattern in the app (it looks like a perfect example where const [modal, setModal] = useState<Modal>({
willAlertModalBecomeVisible: false,
isVisible: false,
});
useEffect(() => {
const unsubscribeOnyxModal = onyxSubscribe({
key: ONYXKEYS.MODAL,
callback: (modalArg) => {
if (modalArg === undefined) {
return;
}
setModal(modalArg);
},
});
return () => {
unsubscribeOnyxModal();
};
}, []); My guess is that there is a problem in Maybe you have some additional context that you'd like to share? @rojiphil @daledah (as you introduced |
Update: From my research I observed that there are a lot of frequent updates to the useOnyxuse-onyx.movwithOnyxwith-onyx.movMy proposal is to ignore failing perf tests and accept more re-renders, my reasoning it that in real environment there is no difference in render count. |
@blazejkustra so when the known issue with Does this mean we'll may encounter the same problem down the road with faulty performance tests that are not truly indicative of a re-rendering performance issue until then? If yes, I think we should get more eyes on this by posting in #expensify-open-source. |
Yes, that's my assumption. If these onyx updates are triggered in a short period of time React is going to batch them, resulting in less renders.
@lakchote It's more complicated than that, performance tests try to recreate the real environment as best as possible, but we can't avoid mocking a bunch of libraries, providers and components. It usually doesn't make a big difference, but I'm sure we have some tests that doesn't bring much value OR more importantly doesn't recreate the real scenario. There is even a proposal that aims to fix this, and issue, therefore I don't think we need to post it on open-source channel. |
useOnyx()
useOnyx()
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.57-10 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-11-13. 🎊 For reference, here are some details about the assignees on this issue:
|
@rojiphil @sakluger 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] |
BugZero Checklist:
Bug classificationSource of bug:
Where bug was reported:
Who reported the bug:
As this was migration work, we can skip this step as no new test case is introduced here. Do we agree 👍 or 👎 |
Job added to Upwork: https://www.upwork.com/jobs/~021856147537785934932 |
useOnyx()
useOnyx()
Current assignee @rojiphil is eligible for the External assigner, not assigning anyone new. |
Summarizing payment on this issue: Contributor: @blazejkustra - No payment required, contractor |
@sakluger Accepted the offer. Thanks. |
All paid, thanks! |
In #50544 issue , migrating from
withOnyx()
touseOnyx()
caused the performance tests to fail (see discussion here).Investigate why and fix it in order to be able to use
useOnyx()
and solve the lint issue.Issue Owner
Current Issue Owner: @Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: