Skip to content

[Due for payment 2025-11-14] [$1250] Forbid inline useOnyx selectors #70272

Closed
8 of 8 issues completed
Closed

Description

@mountiny

coming from this proposal

Background

Selectors in react-native-onyx are functions that allow to subscribe a subset of data from storage, providing performance benefits by only re-rendering components when the selected data changes, rather than when any property in the entire object changes. They transform, filter, or extract specific data and support type-safe operations on both individual keys and collections.

Recently we merged a couple of improvements to useOnyx, including the memoization working properly with stable references. However, most of our codebase still uses inline selectors, which prevents us from taking advantage of these optimizations.

Problem

When using selectors in useOnyx, if you define the selector as inline function directly in the options object, then the memoization system breaks causing unnecessary re-computations and re-renders on every component update.

Solution

Make selectors first-class citizens in E/App by organizing them according to their usage scope:

  • Shared selectors: if a selector is reused across multiple components, define it in a dedicated selectors/ directory so it can be consistently imported and reused.
  • Local selectors: if a selector exists purely for the needs of a single component or hook, define it in the same file outside the component where it’s used to avoid unnecessary abstraction.
  • Contextual selectors: if a selector relies on additional data from the component itself, define it as a useCallback inside the component, with the relevant data passed as dependencies.
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021965762166257784585
  • Upwork Job ID: 1965762166257784585
  • Last Price Increase: 2025-11-10
Issue OwnerCurrent Issue Owner: @TMisiukiewicz

Sub-issues

Sub-issues

8 of 8 Issues completed
Loading 8 sub-issues

Activity

  1. added
    Daily
    Bug
    on Sep 10, 2025
  2. moved this from CRITICAL to HIGH in [#whatsnext] #qualityon Sep 10, 2025
  3. melvin-bot commented on Sep 10, 2025

    @melvin-bot

    Triggered auto assignment to @heyjennahay (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  4. added
    External
    AutoAssignerNewDotQuality
    on Sep 10, 2025
  5. changed the title [-]Forbid inline useOnyx selectors[/-] [+][$250] Forbid inline useOnyx selectors[/+] on Sep 10, 2025
  6. melvin-bot commented on Sep 10, 2025

    @melvin-bot
  7. added
    Help Wanted
    on Sep 10, 2025
  8. melvin-bot commented on Sep 10, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @dukenv0307 (External)

  9. 68 remaining items

  10. added
    Daily
    and removed
    Weekly
    on Nov 14, 2025
  11. melvin-bot commented on Nov 14, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@heyjennahay)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1965762166257784585/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  12. heyjennahay commented on Nov 18, 2025

    @heyjennahay
    Contributor

    Confirming payment summary:

    • @dukenv0307 please submit payment request for $1250 through NewDot Manual Requests
  13. twisterdotcom commented on Nov 19, 2025

    @twisterdotcom
    Contributor

    @dukenv0307 has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-e10b-ae64-c793-872848369441
  14. melvin-bot commented on Nov 27, 2025

    @melvin-bot

    @dukenv0307 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

  15. melvin-bot commented on Dec 4, 2025

    @melvin-bot

    This issue has not been updated in over 14 days. @carlosmiceli, @heyjennahay, @TMisiukiewicz, @dukenv0307 eroding to Weekly issue.

  16. heyjennahay commented on Dec 5, 2025

    @heyjennahay
    Contributor

    Looks like we're all done here. Thanks everyone for your work 👍

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

Metadata

Metadata

Labels

AutoAssignerNewDotQualityAwaiting PaymentBugExternalWeekly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions