Merge pull request #1689 from famedly/krille/delete-in-transactions-idb

fix: Correctly null cache in transactions for indexeddb
This commit is contained in:
Krille-chan 2024-01-22 15:00:50 +01:00 committed by GitHub
commit 0d69e37389
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -158,7 +158,7 @@ class Box<V> {
Future<void> delete(String key, [Transaction? txn]) async {
if (boxCollection._txnCache != null) {
boxCollection._txnCache!.add((txn) => delete(key, txn));
_cache.remove(key);
_cache[key] = null;
_cachedKeys?.remove(key);
return;
}
@ -177,7 +177,9 @@ class Box<V> {
Future<void> deleteAll(List<String> keys, [Transaction? txn]) async {
if (boxCollection._txnCache != null) {
boxCollection._txnCache!.add((txn) => deleteAll(keys, txn));
keys.forEach(_cache.remove);
for (final key in keys) {
_cache[key] = null;
}
_cachedKeys?.removeAll(keys);
return;
}