fix(svelte) hiding elements considers missing html elements

This commit is contained in:
Peter
2023-11-08 13:12:34 +01:00
parent 351ba3c863
commit 2ebdca0525
2 changed files with 25 additions and 14 deletions
@@ -83,6 +83,12 @@
type: 'custom',
data: { label: 'Custom Node' },
position: { x: 150, y: 300 }
},
{
id: 'hideunhide',
data: { label: 'HIDE ME' },
position: { x: 300, y: 75 },
hidden: true
}
]);
@@ -179,6 +185,13 @@
<Panel position="top-right">
<button on:click={updateNode}>update node pos</button>
<button on:click={updateEdge}>update edge type</button>
<button
on:click={() => {
console.log($nodes, $nodes.length);
$nodes[$nodes.length - 1].hidden = !$nodes[$nodes.length - 1].hidden;
$nodes = $nodes;
}}>hide/unhide</button
>
</Panel>
</SvelteFlow>