Skip to content

Commit 563f6a3

Browse files
committed
update key invalidation
1 parent 1b0b7d1 commit 563f6a3

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

lib/OnyxSnapshotCache.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,12 @@ class OnyxSnapshotCache {
9090
// Always invalidate the exact key
9191
this.snapshotCache.delete(keyToInvalidate);
9292

93-
// Handle collection-related keys with selective invalidation
94-
if (OnyxUtils.isCollectionKey(keyToInvalidate)) {
95-
const baseKey = OnyxUtils.getCollectionKey(keyToInvalidate);
96-
97-
// If this is a collection member key (e.g., "reports_123")
98-
// Only invalidate upward to the collection base key
99-
if (baseKey !== keyToInvalidate) {
100-
this.snapshotCache.delete(baseKey);
101-
}
93+
try {
94+
// Check if the key is a collection member and invalidate the collection base key
95+
const collectionBaseKey = OnyxUtils.getCollectionKey(keyToInvalidate);
96+
this.snapshotCache.delete(collectionBaseKey);
97+
} catch (e) {
98+
// do nothing - this just means the key is not a collection member
10299
}
103100
}
104101

0 commit comments

Comments
 (0)