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.
This commit is contained in:
vegu-ai-tools
2025-09-21 20:47:22 +03:00
parent 533a618658
commit 2fe1f4ff82

View File

@@ -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);