From 534a2a4ff1803912b19d6ab30e803b7940f20cca Mon Sep 17 00:00:00 2001 From: Krille Date: Mon, 22 Jan 2024 14:53:42 +0100 Subject: [PATCH] fix: Correctly null cache in transactions for indexeddb This is similar to the bug in the sqflite but now for the indexeddb. --- lib/src/database/indexeddb_box.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/src/database/indexeddb_box.dart b/lib/src/database/indexeddb_box.dart index ba04971b..f4c3ccbe 100644 --- a/lib/src/database/indexeddb_box.dart +++ b/lib/src/database/indexeddb_box.dart @@ -158,7 +158,7 @@ class Box { Future 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 { Future deleteAll(List 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; }