bcakmakoglu / vue-flow

A highly customizable Flowchart component for Vue 3. Features seamless zoom & pan 🔎, additional components like a Minimap 🗺 and utilities to interact with state and graph.
https://vueflow.dev/
MIT License
3.76k stars 243 forks source link

🐛 [BUG]: Auto-generated Handle ids change with position #1393

Closed bcakmakoglu closed 3 months ago

bcakmakoglu commented 4 months ago

Is there an existing issue for this?

Current Behavior

Currently, if a handle is not explicitly assigned an id, one will be auto-generated. The auto-generated id depends on the position of a handle, which causes edges created to those handles to fail their handle lookup if the position prop of the handle is changed after the edge was already created.

Expected Behavior

Handles should not require an id as long as not multiple of the same type (source / target) are used. Furthermore handles should not auto-generate an id themselves if no id was explicitly passed, allowing us to fall back to the first handle of each type when looking up an edges' handles.

Steps To Reproduce

  1. Create an edge between two nodes
  2. Change the handle position of the nodes
  3. Update node internals to signal the position change
  4. Edge does not update to the new handle positions

Relevant log output

No response

Anything else?

This might be a breaking change since existing users might expect handle ids to pop up with new connections as that's the current behavior.

This change might be pushed into the next major release to avoid breaking existing users apps.

bcakmakoglu commented 3 months ago

Fixed and refactored with 1.35.0