open-source-labs / Svelvet

🎛 A Svelte library for building dynamic, infinitely customizable node-based user interfaces and flowcharts
https://svelvet.io
2.5k stars 161 forks source link

Parasitic on:connection events are firing when connections created programatically (not manually) through Anchors' props #491

Open kkarpeev opened 7 months ago

kkarpeev commented 7 months ago

Hello! There is a problem as described in topic, ver 8.
I have Nodes with Anchors (and connections) rendered inside #each block depending on data prop from outside. So when I draw connections I need to update the data. And when connections are rendered on:connection events are fired. I think, it is wrong, because we already know about components we render, but what's worse is that we cannot distinguish between events fired for already created anchor connections (by rerendering Nodes and Anchors if changed) and those we creating manually. Can't imagine a case when we need to catch on:connection for already created connections, maybe there are some, dunno.
But if you don't want to remove these firings, can you, please, at least add some flag to distinguish a manual anchor connection from a programatically created from outside?

j6k4m8 commented 2 months ago

Agreed — ideally this wouldn't catch programmatic edges at all, but flag is definitely a fine option!