From 2fe1f4ff82da3ae35abaef09c447fb82cfbfbf28 Mon Sep 17 00:00:00 2001 From: vegu-ai-tools <152010387+vegu-ai-tools@users.noreply.github.com> Date: Sun, 21 Sep 2025 20:47:22 +0300 Subject: [PATCH] Enhance Node Deletion Handling in NodeEditorLibrary - Updated logic to prevent selecting a deleted node as the first module in the list, ensuring a smoother user experience when nodes are removed. --- talemate_frontend/src/components/NodeEditorLibrary.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/talemate_frontend/src/components/NodeEditorLibrary.vue b/talemate_frontend/src/components/NodeEditorLibrary.vue index 462c6f15..eac52234 100644 --- a/talemate_frontend/src/components/NodeEditorLibrary.vue +++ b/talemate_frontend/src/components/NodeEditorLibrary.vue @@ -535,10 +535,11 @@ export default { this.newModuleDialog = false; } else if(message.action === 'deleted_node_module') { this.requestNodeLibrary(); - // select the first node in the list - console.log("Selected node path", this.selectedNodePath, message.path); + // select the first node in the list, unless the first module is the one + // that was just deleted (the listing may not have been updated yet) + const firstModuleIsDeleted = message.path === this.listedNodes.scenes[0]?.fullPath if(this.selectedNodePath === message.path) { - if(this.listedNodes.scenes.length > 0) { + if(this.listedNodes.scenes.length > 0 && !firstModuleIsDeleted) { this.$emit('load-node', this.listedNodes.scenes[0].fullPath); } else if(this.listedNodes.templates.length > 0) { this.$emit('load-node', this.listedNodes.templates[0].fullPath);