Skip to content

Build your personal knowledge base with Trilium Notes

fix(tree): navigating to parent note when deleting a non-active note (closes #9380)

Elian Doran1c93636538f9
diff --git a/apps/client/src/widgets/note_tree.ts b/apps/client/src/widgets/note_tree.ts
index 5c2aadb1ea..2617be3e01 100644
--- a/apps/client/src/widgets/note_tree.ts
+++ b/apps/client/src/widgets/note_tree.ts
@@ -1614,7 +1614,14 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
return;
}
- await branchService.deleteNotes(branchIds);
+ // Only navigate to parent if deleting the currently active note
+ const activeNoteId = appContext.tabManager.getActiveContext()?.noteId;
+ const isDeletingActiveNote = branchIds.some((branchId) => {
+ const branch = froca.getBranch(branchId);
+ return branch?.noteId === activeNoteId;
+ });
+
+ await branchService.deleteNotes(branchIds, false, isDeletingActiveNote);
this.clearSelectedNodes();
}