Skip to content

Commit

Permalink
fix use full collection member key as object key
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Jul 30, 2024
1 parent 63d5a7b commit 8de1447
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/Onyx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,13 +587,12 @@ function clear(keysToPreserve: OnyxKey[] = []): Promise<void> {
if (newValue !== oldValue) {
cache.set(key, newValue);

const potentialCollectionKey = OnyxUtils.getCollectionKey(key);
if (OnyxUtils.isCollectionKey(potentialCollectionKey)) {
const [collectionKey, memberKey] = OnyxUtils.splitCollectionMemberKey(key);
const collectionKey = OnyxUtils.getCollectionKey(key);
if (OnyxUtils.isCollectionKey(collectionKey)) {
if (!keyValuesToResetAsCollection[collectionKey]) {
keyValuesToResetAsCollection[collectionKey] = {};
}
keyValuesToResetAsCollection[collectionKey]![memberKey] = newValue ?? undefined;
keyValuesToResetAsCollection[collectionKey]![key] = newValue ?? undefined;
} else {
keyValuesToResetIndividually[key] = newValue ?? undefined;
}
Expand Down

0 comments on commit 8de1447

Please sign in to comment.