Skip to content

Build your personal knowledge base with Trilium Notes

fix removing stale branches from saved search after refresh, fixes #1354

zadam4f75b6aaafef
diff --git a/src/public/app/services/toast.js b/src/public/app/services/toast.js
index 02e2595ca7..d51cad528f 100644
--- a/src/public/app/services/toast.js
+++ b/src/public/app/services/toast.js
@@ -54,7 +54,7 @@ function closePersistent(id) {
}
function showMessage(message, delay = 2000) {
- console.debug(utils.now(), "message: ", message);
+ console.debug(utils.now(), "message:", message);
toast({
title: "Info",
diff --git a/src/public/app/services/tree_cache.js b/src/public/app/services/tree_cache.js
index f8fe862ac1..e3649d18fd 100644
--- a/src/public/app/services/tree_cache.js
+++ b/src/public/app/services/tree_cache.js
@@ -203,6 +203,11 @@ class TreeCache {
// force to load all the notes at once instead of one by one
await this.getNotes(searchResultNoteIds);
+ // reset all the virtual branches from old search results
+ if (note.noteId in treeCache.notes) {
+ treeCache.notes[note.noteId].children = [];
+ }
+
const branches = resp.branches.filter(b => b.noteId === note.noteId || b.parentNoteId === note.noteId);
searchResultNoteIds.forEach((resultNoteId, index) => branches.push({