Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/OnyxCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,7 @@ class OnyxCache {
return undefined;
}

// Return a shallow copy to ensure React detects changes when items are added/removed
return {...cachedCollection};
return cachedCollection;
}
}

Expand Down
3 changes: 2 additions & 1 deletion lib/OnyxUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,8 @@ function tryGetCachedValue<TKey extends OnyxKey>(key: TKey): OnyxValue<OnyxKey>
if (isCollectionKey(key)) {
const collectionData = cache.getCollectionData(key);
if (collectionData !== undefined) {
val = collectionData;
// Return a shallow copy to ensure React detects changes when items are added/removed
val = {...collectionData};
} else {
// If we haven't loaded all keys yet, we can't determine if the collection exists
if (cache.getAllKeys().size === 0) {
Expand Down