Skip to content

Commit

Permalink
fix(store): clear collections before clearing the store
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Feb 23, 2025
1 parent d4cce23 commit 17f3c8b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ class Store<Collections extends CollectionsDefinition> {
}

public async clear(): Promise<void> {
const pendingCollections: Array<Promise<void>> = []

for (const [, collection] of this.collections) {
pendingCollections.push(collection.deleteAll())
}

await Promise.allSettled(pendingCollections)
this.collections.clear()
}
}
Expand Down

0 comments on commit 17f3c8b

Please sign in to comment.