Skip to content
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-25] [Performance] useOnyx doesn't return new data if the selector changes but the data in the store is the same #52597

Closed
6 tasks done
pac-guerreiro opened this issue Nov 14, 2024 · 36 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Engineering NewFeature Something to build that is a new item. Weekly KSv2

Comments

@pac-guerreiro
Copy link
Contributor

pac-guerreiro commented Nov 14, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


What performance issue do we need to solve?

Inefficient React component rendering when onyx collection data is updated, although we're only accessing unmodified entries of the onyx collection.

Example case: #49919 (review)

What is the impact of this on end-users?

App performance can degrade with the inefficient rendering

List any benchmarks that show the severity of the issue

N/A

Proposed solution (if any)

Mimic dependency array from some React hooks, like useEffect, to force useOnyx to fetch data if any dependency changes.

Something like useOnyx(key, options, [dependencyA]).

List any benchmarks after implementing the changes to show impacts of the proposed solution (if any)

N/A

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Version Number: v9.0.62-4
Reproducible in staging?: yes
Reproducible in production?: yes
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: #49919 (review)
Expensify/Expensify Issue URL:
Issue reported by:
Slack conversation:

View all open jobs on Upwork

Issue OwnerCurrent Issue Owner: @sonialiap
Copy link

melvin-bot bot commented Nov 14, 2024

Auto-assigning issues to engineers is no longer supported. If you think this issue should receive engineering attention, please raise it in #whatsnext.

@pac-guerreiro
Copy link
Contributor Author

pac-guerreiro commented Nov 14, 2024

@mountiny can you make this issue internal? @fabioh8010 and I are working on it

@fabioh8010
Copy link
Contributor

You tagged the wrong person @pac-guerreiro , it's @mountiny 😄

@pac-guerreiro
Copy link
Contributor Author

Ups, sorry! 😅

@mountiny
Copy link
Contributor

Sounds good

@pac-guerreiro
Copy link
Contributor Author

Last friday I didn't work on this but tomorrow I'll open a draft PR with a possible solution

@pac-guerreiro
Copy link
Contributor Author

I opened a draft PR with a possible solution for this issue - Expensify/react-native-onyx#599

If you all agree, I can also create an eslint rule to enforce the usage of the dependency array when developers pass variables in useOnyx selector. To achieve it, I'll need to adapt this and create an additional PR to add this new rule to https://github.com/Expensify/eslint-config-expensify

@pac-guerreiro
Copy link
Contributor Author

I'm waiting on @fabioh8010 feedback on this since he has an alternate solution

@fabioh8010
Copy link
Contributor

We are currently discussing the issue internally.

@pac-guerreiro
Copy link
Contributor Author

Today @fabioh8010 and I discussed this issue internally. There are some ideas on the table on how to tackle this issue, so we'll continue discussing them tomorrow!

@pac-guerreiro
Copy link
Contributor Author

Today @fabioh8010 continued our discussion, we are still trying to find a proper solution for this issue.

@pac-guerreiro
Copy link
Contributor Author

Today I tried more possible solutions and discussed them with @fabioh8010. I've been having problems with infinite loops on getSnapshot. On Monday I'm going to discuss an alternative idea of @fabioh8010 for this performance issue.

Copy link

melvin-bot bot commented Nov 26, 2024

@fabioh8010, @mountiny, @pac-guerreiro Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Nov 26, 2024
@pac-guerreiro
Copy link
Contributor Author

Yesterday I was able to provide a possible solution to the problem and created a draft PR - Expensify/react-native-onyx#601

@fabioh8010 provided a solution of his, which I didn't have the time to check yesterday but today I'll do it!

@melvin-bot melvin-bot bot removed the Overdue label Nov 26, 2024
@pac-guerreiro
Copy link
Contributor Author

Today I reviewed @fabioh8010 solution and we discussed it. We need to confirm which one is the best and how we should proceed next

@fabioh8010
Copy link
Contributor

fabioh8010 commented Nov 28, 2024

Taking this issue over Pedro since he's going to be OOO until December 12th

Copy link

melvin-bot bot commented Dec 2, 2024

@fabioh8010, @mountiny, @pac-guerreiro Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Dec 2, 2024
@fabioh8010
Copy link
Contributor

Update: We agreed to test my solution against E/App and if everything is ok, we will proceed with it.

Copy link

melvin-bot bot commented Dec 4, 2024

@fabioh8010, @mountiny, @pac-guerreiro 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@fabioh8010
Copy link
Contributor

Created a WIP Draft PR, testing the solution against E/App.

@fabioh8010
Copy link
Contributor

Will open the Bump PR today

@fabioh8010 fabioh8010 mentioned this issue Dec 10, 2024
50 tasks
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 Overdue labels Dec 10, 2024
@fabioh8010
Copy link
Contributor

Bump PR created -> #53890

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Dec 18, 2024
@melvin-bot melvin-bot bot changed the title [Performance] useOnyx doesn't return new data if the selector changes but the data in the store is the same [HOLD for payment 2024-12-25] [Performance] useOnyx doesn't return new data if the selector changes but the data in the store is the same Dec 18, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 18, 2024
Copy link

melvin-bot bot commented Dec 18, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Dec 18, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.76-12 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-25. 🎊

For reference, here are some details about the assignees on this issue:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Dec 25, 2024
Copy link

melvin-bot bot commented Dec 25, 2024

Skipping the payment summary for this issue since all the assignees are employees or vendors. If this is incorrect, please manually add the payment summary SO.

@mountiny mountiny added the NewFeature Something to build that is a new item. label Dec 28, 2024
@melvin-bot melvin-bot bot added the Overdue label Dec 28, 2024
Copy link

melvin-bot bot commented Dec 28, 2024

Triggered auto assignment to @sonialiap (NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details. Please add this Feature request to a GH project, as outlined in the SO.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Overdue Daily KSv2 labels Dec 28, 2024
Copy link

melvin-bot bot commented Dec 28, 2024

⚠️ It looks like this issue is labelled as a New Feature but not tied to any GitHub Project. Keep in mind that all new features should be tied to GitHub Projects in order to properly track external CAP software time ⚠️

Copy link

melvin-bot bot commented Dec 28, 2024

Auto-assign attempt failed, all eligible assignees are OOO.

@mountiny
Copy link
Contributor

$250 to @sobitneupane No need for regression testing on this one

@sonialiap
Copy link
Contributor

Payment summary:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Engineering NewFeature Something to build that is a new item. Weekly KSv2
Projects
None yet
Development

No branches or pull requests

5 participants