Skip to content

Build your personal knowledge base with Trilium Notes

extra check that hidden tree is not created until migration is completed

zadam9eff08144c27
diff --git a/src/services/hidden_subtree.js b/src/services/hidden_subtree.js
index b6be8d619c..b97baf4a8c 100644
--- a/src/services/hidden_subtree.js
+++ b/src/services/hidden_subtree.js
@@ -1,6 +1,8 @@
const becca = require("../becca/becca");
const noteService = require("./notes");
const Attribute = require("../becca/entities/attribute.js");
+const log = require("./log");
+const migrationService = require("./migration");
const LBTPL_ROOT = "_lbTplRoot";
const LBTPL_BASE = "_lbTplBase";
@@ -231,6 +233,12 @@ const HIDDEN_SUBTREE_DEFINITION = {
};
function checkHiddenSubtree() {
+ if (!migrationService.isDbUpToDate()) {
+ // on-delete hook might get triggered during some future migration and cause havoc
+ log.info("Will not check hidden subtree until migration is finished.");
+ return;
+ }
+
checkHiddenSubtreeRecursively('root', HIDDEN_SUBTREE_DEFINITION);
}
diff --git a/src/services/migration.js b/src/services/migration.js
index 1bda273e49..7bda5bc36a 100644
--- a/src/services/migration.js
+++ b/src/services/migration.js
@@ -119,5 +119,6 @@ async function migrateIfNecessary() {
}
module.exports = {
- migrateIfNecessary
+ migrateIfNecessary,
+ isDbUpToDate
};