diff --git a/static/js/app.mjs b/static/js/app.mjs index 0842b03..7a9ac52 100644 --- a/static/js/app.mjs +++ b/static/js/app.mjs @@ -195,8 +195,7 @@ export class App { // This is a bad idea when quickly navigating the tree, since the arrow navigation // has collapsed nodes which the event calling goToNode can come to undo, if the // event processing lags behind. - if (!dontExpand) - await this.sidebar.makeVisible(node, ancestors) + await this.sidebar.makeVisible(node, ancestors, dontExpand) _mbus.dispatch('CRUMBS_SET', ancestors, () => this.crumbsElement.replaceChildren(this.crumbs.render())) _mbus.dispatch('NODE_UI_OPEN', { node, eventSequence: this.showNodeEventSequence.next() }) diff --git a/static/js/sidebar.mjs b/static/js/sidebar.mjs index 9c06e81..d1263a3 100644 --- a/static/js/sidebar.mjs +++ b/static/js/sidebar.mjs @@ -429,12 +429,14 @@ export class N2Sidebar extends CustomHTMLElement { if (!state) await this.setNodeExpanded(node, false) }//}}} - async makeVisible(node, providedAncestors) {// {{{ + async makeVisible(node, providedAncestors, dontExpand) {// {{{ const treenode = this.treeNodeComponents[node.UUID] - const ancestors = providedAncestors || await nodeStore.getNodeAncestry(node) - for (const ancestor of ancestors.reverse()) { - this.setNodeExpanded(ancestor, true) + if (!dontExpand) { + const ancestors = providedAncestors || await nodeStore.getNodeAncestry(node) + for (const ancestor of ancestors.reverse()) { + this.setNodeExpanded(ancestor, true) + } } treenode?.scrollIntoView({ block: 'nearest' })