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 Owner
Current Issue Owner: @VickyStash
Description
Onyx v3.0.59 (react-native-onyx#756) added a state reset inside useOnyx's
subscribecallback to fix stale data when dynamically switching keys. However, the reset runs unconditionally — including on initial mount — which causesuseSyncExternalStoreto see a new snapshot reference after subscription, triggering one extra render peruseOnyxhook.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 intoreact-native-onyxso the patch can be removed.Related
Issue Owner
Current Issue Owner: @VickyStash