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
21.84k stars 1.45k forks source link

updateNodeData does not run consistently in 12.0.0-next.12, next.13, next.14 #4147

Closed NawarA closed 1 month ago

NawarA commented 1 month ago

Describe the Bug

updateNodeData works consistently in 12.0.0-next.11

Consistently means it always works as expected.

So

// updates the node's data property 100% of the time
updateNodeData( id, data )

Ever since 12.0.0-next.12 the command updateNodeData( id, data ) no longer updates the node data property consistently.

So

// SOMETIMES update the node's data property
updateNodeData( id, data )

When I downgrade from 12.0.0-next.14 to 12.0.0-next.11, the update function works again.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

See code samples above...sorry I didn't create a separate repo with completely isolated code, but hopefully being to replicate the error is easy for you...just run the updateNodeData( id, data ).

By the way, in case it's helpful to mention, I usually update multiple nodeId's during the same execution, not sure if that's related to the root of the problem, but thought I'd mention it, as its part my setup of the issue.

Expected behavior

// updates the node's data property 100% of the time
updateNodeData( id, data )

Screenshots or Videos

No response

Platform

Additional context

No response

moklick commented 1 month ago

Thanks for helping with the 12 release. We will try to find out what is wrong here.

moklick commented 1 month ago

I can't reproduce this. Can you create a codesandbox for this? Maybe you can use this as a starting point https://codesandbox.io/p/sandbox/reactflow-reactive-flow-34lk98?file=/src/Flow.tsx

NawarA commented 1 month ago

I setup a codesandbox env, but I'm unable to replicate the bug so far.

A few observations:

AndreBurkett commented 1 month ago

I believe that I am experiencing the same issue in next.14. For me, the issue occurs when connecting nodes in parallel. I've included a codesandbox below which demonstrates that only 1 path from the "Hello" textbox gets updated. A few things I've noticed, when connecting nodes in the following order A->B->C->D and A->E->F, G, with node A connected to both B and E:

https://codesandbox.io/p/sandbox/reactflow-reactive-flow-forked-c87mwh

moklick commented 1 month ago

Thanks again for the very detailed report! updateNode and updateNodeData was indeed a bit broken. This should be fixed in 12.0.0-next.16.