xyflow / xyflow

React Flow | Svelte Flow - Powerful open source libraries for building node-based UIs with React (https://reactflow.dev) or Svelte (https://svelteflow.dev). Ready out-of-the-box and infinitely customizable.
https://xyflow.com
MIT License
22.07k stars 1.46k forks source link

[SvelteFlow] Nodes with unchanged IDs becoming invisible in SvelteFlow 0.0.40 #4160

Closed darabos closed 2 months ago

darabos commented 2 months ago

Describe the Bug

In SvelteFlow 0.0.40 if the nodes store is updated in a way that keeps the ID, the node disappears. It visibility: hidden is set for it, which I take it to mean that it becomes uninitialized — its dimensions are not recomputed as they should be.

const nodes = writable([{ id: '1', data: { label: 'Hello' }, position: { x: 0, y: 0 } }]);
// Calling this function causes the node to disappear.
function test() {
  nodes.set([{ id: '1', data: { label: 'Test' }, position: { x: 0, y: 0 } }]);
}

This is a regression. Up to 0.0.39 this code was working. (Unfortunately, 0.0.40 is the first time I'm using SvelteFlow. 😅 I love it otherwise. Thanks for the fantastic work!)

Steps to Reproduce the Bug or Issue

See https://stackblitz.com/edit/svelte-flow-ts-rfyvxb?file=src%2FFlow%2Findex.svelte. If you click "Test" the node disappears. If you change the ID in test(), the node will be correctly replaced the first time the button is clicked. It will disappear on the second click.

Expected behavior

On SvelteFlow 0.0.39 and earlier the node is properly replaced. This is the expected behavior.

Platform

darabos commented 2 months ago

SvelteFlow is released from this repo, right? How do I find the tags for 0.0.39 and 0.0.40? Maybe I can find what causes this.

moklick commented 2 months ago

Thanks for bringing this up! We are currently in a weird re-write state - it should be fixed in 0.0.41