You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There, an array of nodes with random positions is rendered on the canvas when clicking the "new node" button. The problematic code is the id="55" bit in line 34. As long as that is there, the deletion of a single node makes all other nodes vanish from the canvas and they only appear again once a new node is added. Removing the id="55" bit fixes the bug.
I stumbled upon this because I copied the code example from https://svelvet.mintlify.app/components/node and forgot to delete the id="55" bit. Is it possible to avoid that bug for others in the future by e.g. issuing a warning on the command line in situations like these?
The text was updated successfully, but these errors were encountered:
I believe the ID overrides the Svelvet Node's id attribute, which is used as a unique identifier in an HTML document.
If all nodes in your graph have the same ID, then deleting one will delete all of them, as they all have the same ID attribute.
I guess the library could warn if multiple components are instantiated with the same ID, however I'd argue it's up to the application to ensure that the IDs are unique.
Ah, I see. Yes, it's definitely my bad, that I gave every Node the same ID with that 😅 . I think a warning like you said would be nice though, if it's not too much of a hassle.
I created a code example at https://stackblitz.com/edit/svelvet-v7-zrfaxy?file=src%2Froutes%2F%2Bpage.svelte
There, an array of nodes with random positions is rendered on the canvas when clicking the "new node" button. The problematic code is the
id="55"
bit in line 34. As long as that is there, the deletion of a single node makes all other nodes vanish from the canvas and they only appear again once a new node is added. Removing theid="55"
bit fixes the bug.I stumbled upon this because I copied the code example from https://svelvet.mintlify.app/components/node and forgot to delete the
id="55"
bit. Is it possible to avoid that bug for others in the future by e.g. issuing a warning on the command line in situations like these?The text was updated successfully, but these errors were encountered: