diff --git a/static/js/app.mjs b/static/js/app.mjs index 7904660..fcc5add 100644 --- a/static/js/app.mjs +++ b/static/js/app.mjs @@ -16,7 +16,7 @@ export class App { document.getElementById('tree-nodes')?.focus() }) - _mbus.subscribe('TREE_TRUNK_FETCHED', async () => { + _mbus.subscribe('TREE_RENDERED', async () => { // Subscribing to the start node existing after the tree trunk is // fetched since the NODE_COMPONENT_EXIST message isn't sent for the // root node itself, and the root node should be selected in the tree @@ -28,6 +28,8 @@ export class App { if (startNode.UUID == ROOT_NODE) this.goToNode(startNode.UUID, false, false) + else + this.goToNode(startNode.UUID, false, false) }) _mbus.subscribe('TREE_NODE_SELECTED', event => { diff --git a/static/js/sidebar.mjs b/static/js/sidebar.mjs index d1263a3..285fd44 100644 --- a/static/js/sidebar.mjs +++ b/static/js/sidebar.mjs @@ -160,6 +160,11 @@ export class N2Sidebar extends CustomHTMLElement { this.treeNodeComponents[startnode.UUID] = starttreenode this.elTreenodes.appendChild(await starttreenode.render()) + // Notify the application that the initial tree is rendered (with children) + // and that initial node selection can take place. App will check URL to + // select the correct one. + _mbus.dispatch('TREE_RENDERED') + this.rendered = true return this }// }}}