Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: fix indexes getting replaced on backup restore

Abdullah Atta4c7cd840df6e
diff --git a/packages/core/src/database/backup.js b/packages/core/src/database/backup.js
index 597c12867..8a0b2e6e4 100644
--- a/packages/core/src/database/backup.js
+++ b/packages/core/src/database/backup.js
@@ -255,9 +255,9 @@ export default class Backup {
}
for (const collectionKey in toAdd) {
- await new Indexer(this._db.storage, collectionKey).writeMulti(
- toAdd[collectionKey]
- );
+ const indexer = new Indexer(this._db.storage, collectionKey);
+ await indexer.init();
+ await indexer.writeMulti(toAdd[collectionKey]);
}
}