Skip to content

Remove selector useLiveRef from Onyx #70296

@roryabraham

Description

@roryabraham

HOLD for #70272

Problem

Selectors in useOnyx are wrapped with useLiveRef to get a stable reference even for inline selectors. This was a helpful convenience when it's added, but some things have changed:

  1. We added a cache for useOnyx that benefits from using a shared stable reference for selectors.
  2. In [Due for payment 2025-11-14] [$1250] Forbid inline useOnyx selectors #70272 we are going to forbid inline selectors and refactor E/App to ensure all selectors are not inline.

After that's done, useLiveRef will contribute complexity without having any value. Furthermore, it may cause unexpected behaviors, in that useOnyx will not re-run if the selector changes unless you explicitly pass the selector as a dependency.

Solution

Remove the useLiveRef wrapper from selectors in useOnyx. We don't need it anymore.

Metadata

Metadata

Labels

ImprovementItem broken or needs improvement.MonthlyKSv2

Type

No type

Projects

Status

LOW

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions