Skip to content

[Onyx] Fix extra mount render introduced in useOnyx v3.0.59 #87850

@cristipaval

Description

@cristipaval

Description

Onyx v3.0.59 (react-native-onyx#756) added a state reset inside useOnyx's subscribe callback to fix stale data when dynamically switching keys. However, the reset runs unconditionally — including on initial mount — which causes useSyncExternalStore to see a new snapshot reference after subscription, triggering one extra render per useOnyx hook.

This was caught by reassure performance tests in this CI run during the Onyx bump PR.

To unblock the bump to 3.0.59 (and all subsequent versions), a patch was applied in E/App (#87738): patches/react-native-onyx+3.0.59.patch. The fix needs to be upstreamed into react-native-onyx so the patch can be removed.

Related

Issue OwnerCurrent Issue Owner: @VickyStash

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions