File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -236,6 +236,12 @@ function useOnyx<TKey extends OnyxKey, TReturnValue = OnyxValue<TKey>>(
236236 if ( ! ( isFirstConnectionRef . current && options ?. initWithStoredValues === false ) && ! shouldGetCachedValueRef . current ) {
237237 const cachedResult = onyxSnapshotCache . getCachedResult < UseOnyxResult < TReturnValue > > ( key , cacheKey ) ;
238238 if ( cachedResult !== undefined ) {
239+ // Collections: preserve reference stability - if data is deeply equal, return same reference
240+ const isCollection = OnyxUtils . isCollectionKey ( key ) ;
241+ if ( isCollection && resultRef . current && cachedResult !== resultRef . current && deepEqual ( cachedResult , resultRef . current ) ) {
242+ return resultRef . current ;
243+ }
244+
239245 resultRef . current = cachedResult ;
240246 return cachedResult ;
241247 }
You can’t perform that action at this time.
0 commit comments