Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
avoid scrolling to active node without a reason, fixes #4031
zadambbe3f436d31c
diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.jsindex 1d8f426f22..e21128a952 100644--- a/src/public/app/widgets/note_tree.js+++ b/src/public/app/widgets/note_tree.js@@ -1002,21 +1002,21 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {this.activityDetected();const oldActiveNode = this.getActiveNode();- let oldActiveNodeFocused = false;- if (oldActiveNode) {- oldActiveNodeFocused = oldActiveNode.hasFocus();-- oldActiveNode.setActive(false);- oldActiveNode.setFocus(false);- }-- if (this.noteContext- && this.noteContext.notePath+ const newActiveNode = this.noteContext?.notePath&& !this.noteContext.note?.isDeleted&& (!treeService.isNotePathInHiddenSubtree(this.noteContext.notePath) || await hoistedNoteService.isHoistedInHiddenSubtree())- ) {- const newActiveNode = await this.getNodeFromPath(this.noteContext.notePath);+ && await this.getNodeFromPath(this.noteContext.notePath);++ if (newActiveNode !== oldActiveNode) {+ let oldActiveNodeFocused = false;++ if (oldActiveNode) {+ oldActiveNodeFocused = oldActiveNode.hasFocus();++ oldActiveNode.setActive(false);+ oldActiveNode.setFocus(false);+ }if (newActiveNode) {if (!newActiveNode.isVisible()) {