Skip to content

Commit

Permalink
fix getCachedCollection caching
Browse files Browse the repository at this point in the history
  • Loading branch information
kacper-mikolajczak committed Aug 5, 2024
1 parent cb15a80 commit 2f237f9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/OnyxUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,12 @@ function keyChanged<TKey extends OnyxKey>(
}

if (isCollectionKey(subscriber.key) && subscriber.waitForCollectionCallback) {
const cachedCollection = cachedCollections[subscriber.key] ?? getCachedCollection(subscriber.key);
let cachedCollection = cachedCollections[subscriber.key];

if (!cachedCollection) {
cachedCollection = getCachedCollection(subscriber.key);
cachedCollections[subscriber.key] = cachedCollection;
}

cachedCollection[key] = value;
subscriber.callback(cachedCollection);
Expand Down

0 comments on commit 2f237f9

Please sign in to comment.