fix(frontend): Disabled delete node + correctly update debug menu when nodes are deleted (#3387)

* fix(frontend): Disabled delete node + correctly handle debug menu

* fix(frontend): improve reactivity
This commit is contained in:
Faton Ramadani
2024-03-11 09:58:07 +01:00
committed by GitHub
parent 1ea5a68132
commit cc05ec419d
2 changed files with 16 additions and 1 deletions
@@ -151,6 +151,21 @@
subGridIndex: nodes.findIndex((node) => node.id === currentNodeId)
}
}
function updateDebuggingComponents() {
const nodeIds = nodes.map((node) => node.id).sort()
const debuggingComponentsIds = Object.keys($debuggingComponents).sort()
if (JSON.stringify(nodeIds) !== JSON.stringify(debuggingComponentsIds)) {
debuggingComponentsIds.forEach((id) => {
if (!nodeIds.includes(id)) {
delete $debuggingComponents[id]
}
})
}
}
$: nodes && $debuggingComponents && updateDebuggingComponents()
</script>
{#if Object.keys(resolvedConditions).length === nodes.length}
@@ -64,7 +64,7 @@
nodes = removeNode(nodes, selectedNode)
renderCount++
}}
disabled={selectedNode?.next?.length > 1}
disabled={selectedNode?.next?.length > 1 || nodes.length == 1}
>
Delete node
</Button>