Skip to content

[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

Description

@pac-guerreiro

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: #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

Activity

  1. melvin-bot commented on Nov 14, 2024

    @melvin-bot

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

  2. pac-guerreiro commented on Nov 14, 2024

    @pac-guerreiro
    ContributorAuthor

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

  3. fabioh8010 commented on Nov 14, 2024

    @fabioh8010
    Contributor

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

  4. pac-guerreiro commented on Nov 14, 2024

    @pac-guerreiro
    ContributorAuthor

    Ups, sorry! 😅

  5. mountiny commented on Nov 14, 2024

    @mountiny
    Contributor

    Sounds good

  6. pac-guerreiro commented on Nov 17, 2024

    @pac-guerreiro
    ContributorAuthor

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

  7. pac-guerreiro commented on Nov 18, 2024

    @pac-guerreiro
    ContributorAuthor

    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

  8. pac-guerreiro commented on Nov 19, 2024

    @pac-guerreiro
    ContributorAuthor

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

  9. fabioh8010 commented on Nov 20, 2024

    @fabioh8010
    Contributor

    We are currently discussing the issue internally.

  10. pac-guerreiro commented on Nov 20, 2024

    @pac-guerreiro
    ContributorAuthor

    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!

  11. 34 remaining items

  12. melvin-bot commented on Dec 25, 2024

    @melvin-bot

    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.

  13. melvin-bot commented on Dec 28, 2024

    @melvin-bot

    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.

  14. melvin-bot commented on Dec 28, 2024

    @melvin-bot

    ⚠️ 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 ⚠️

  15. melvin-bot commented on Dec 28, 2024

    @melvin-bot

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

  16. mountiny commented on Dec 28, 2024

    @mountiny
    Contributor

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

  17. sonialiap commented on Dec 30, 2024

    @sonialiap
    Contributor

    Payment summary:

  18. garrettmknight commented on Mar 24, 2025

    @garrettmknight
    Contributor

    $250 approved for @sobitneupane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionEngineeringNewFeatureSomething to build that is a new item.WeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions