Skip to content

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

fix: init notes before cleaning up notebooks

thecodrr9f0ae2e76f0a
diff --git a/packages/core/collections/notebooks.js b/packages/core/collections/notebooks.js
index 22693360c..f07db4f4a 100644
--- a/packages/core/collections/notebooks.js
+++ b/packages/core/collections/notebooks.js
@@ -131,7 +131,8 @@ export default class Notebooks extends Collection {
}
}
- cleanup() {
+ async cleanup() {
+ await this._db.notes.init();
for (let notebook of this.all) {
for (let topic of notebook.topics) {
const clonedIds = topic.notes.slice();
diff --git a/packages/core/database/backup.js b/packages/core/database/backup.js
index ba45eb1cb..37003dca4 100644
--- a/packages/core/database/backup.js
+++ b/packages/core/database/backup.js
@@ -142,7 +142,7 @@ export default class Backup {
];
if (await this._migrator.migrate(collections, (id) => data[id], version)) {
- this._db.notebooks.cleanup();
+ await this._db.notebooks.cleanup();
}
}