mirror of
https://github.com/vegu-ai/talemate.git
synced 2025-12-24 23:49:28 +01:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user