Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.55k stars 2.89k forks source link

[Performance] useOnyx doesn't return new data if the selector changes but the data in the store is the same #52597

Open pac-guerreiro opened 5 hours ago

pac-guerreiro commented 5 hours ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com 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: https://github.com/Expensify/App/pull/49919#pullrequestreview-2346813622

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?

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: https://github.com/Expensify/App/pull/49919#pullrequestreview-2346813622 Expensify/Expensify Issue URL: Issue reported by: Slack conversation:

View all open jobs on Upwork

melvin-bot[bot] commented 5 hours ago

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 commented 4 hours ago

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

fabioh8010 commented 4 hours ago

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

pac-guerreiro commented 4 hours ago

Ups, sorry! 😅

mountiny commented 3 hours ago

Sounds good