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
When I create a new Edge in the UI, I want get the freshly created edge in code, so I can store it (for example). But I think I haven't found the correct way of doing this.
My idea was to subscribe to the The onEdgesChange callback, which (according to https://reactflow.dev/api-reference/types/edge-change) has a EdgeAddChange variant, which should contain the Edge item. Through the callback I get all kinds of changes to the edges, but never the Add-variant. (see my code below).
As a side note; I see the same behaviour when I add a new node. I see all kinds of changes to the nodes (position, selected, deleted) but never the NodeAddChange<T = any>, which should exist according to https://reactflow.dev/api-reference/types/node-change
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When I create a new Edge in the UI, I want get the freshly created edge in code, so I can store it (for example). But I think I haven't found the correct way of doing this.
My idea was to subscribe to the The onEdgesChange callback, which (according to https://reactflow.dev/api-reference/types/edge-change) has a EdgeAddChange variant, which should contain the Edge item. Through the callback I get all kinds of changes to the edges, but never the Add-variant. (see my code below).
Then I looked at the 'onConnect' callback, but this gives back a 'Connection', which doesn't contain the new Edge (https://reactflow.dev/api-reference/types/connection).
So, my question is: how can I get a freshly created Edge object?
Of course I don't want to do things like a before- and after comparison of the edges collection :)
As a side note; I see the same behaviour when I add a new node. I see all kinds of changes to the nodes (position, selected, deleted) but never the NodeAddChange<T = any>, which should exist according to https://reactflow.dev/api-reference/types/node-change
Beta Was this translation helpful? Give feedback.
All reactions