diff --git a/static/js/app.mjs b/static/js/app.mjs index 4a1faec..89c0011 100644 --- a/static/js/app.mjs +++ b/static/js/app.mjs @@ -161,7 +161,12 @@ export class App { return const nn = Node.create(name, this.currentNode.UUID) - nn.save() + await nn.save() + + // Treenode is forcefully rerendered and children refetched to both show the new node + // and to get it resorted. + const treenode = this.sidebar.getTreeNode(this.currentNode.UUID) + treenode.render(true, true) }//}}} async goToNode(nodeUUID, dontPush, dontExpand) {//{{{ if (nodeUUID === null || nodeUUID === undefined) diff --git a/static/js/page_node.mjs b/static/js/page_node.mjs index 8f4feb1..40997e2 100644 --- a/static/js/page_node.mjs +++ b/static/js/page_node.mjs @@ -291,7 +291,6 @@ export class Node { Name: name, ParentUUID: parentUUID, Markdown: false, - History: false, }) // Newly created node (not constructed from existing data) is considered modified diff --git a/static/js/sidebar.mjs b/static/js/sidebar.mjs index 23c78c0..8d5bcbd 100644 --- a/static/js/sidebar.mjs +++ b/static/js/sidebar.mjs @@ -212,6 +212,9 @@ export class N2Sidebar extends CustomHTMLElement { isSelected(node) {//{{{ return this.selectedNode?.UUID === node.UUID }//}}} + getTreeNode(uuid) {// {{{ + return this.treeNodeComponents[uuid] + }// }}} async keyHandler(event) {//{{{ let handled = true @@ -514,8 +517,8 @@ export class N2TreeNode extends CustomHTMLElement { if (this.rendered && force_update !== true) return this - if (this.sidebar.getNodeExpanded(this.node.UUID)) - await this.fetchChildren() + if (this.sidebar.getNodeExpanded(this.node.UUID) || force_refetch_children) + await this.fetchChildren(force_refetch_children) // Update the name and selected status. this.elName.querySelector('span').innerText = this.node.get('Name')