diff --git a/packages/core/storage/src/storage.ts b/packages/core/storage/src/storage.ts index 0271b03d6..8f13efc5f 100644 --- a/packages/core/storage/src/storage.ts +++ b/packages/core/storage/src/storage.ts @@ -164,7 +164,7 @@ export class AlwatrStorage { this._logger.logMethodArgs('set', documentObject._id); const oldData = this._storage[documentObject._id]; - if (oldData == null) this._keys = null; // Clear cached keys on new docId + if (oldData == null) this._keys = null; // Clear cached keys if (fastInstance !== true) { documentObject = JSON.parse(JSON.stringify(documentObject)); @@ -199,6 +199,10 @@ export class AlwatrStorage { } // else delete this._storage[documentId]; + + // Clear cached keys + this._keys = null; + this.save(); return true; } @@ -267,5 +271,8 @@ export class AlwatrStorage { this.forceSave(); } this._storage = {}; + + // Clear cached keys + this._keys = null; } }