community-edition icon indicating copy to clipboard operation
community-edition copied to clipboard

connectionDetached called before jsPlumb object is updated

Open DedicatedManagers opened this issue 8 years ago • 1 comments

When a connection is detached, I need to loop over the jsPlumb object to rebuild my app's understanding of how all the objects are connected to each other.

It appears as though connectionDetached is called before the jsPlumb object itself is updated with the change.

For example say I have the connections below: A->B->C->D

If I remove the connection from C->D, during the connectionDetached event, the jsPlumb object still thinks C is connected to D.

I'm currently solving my issue by setting a setTimeOut event in the connectionDetached for a delay of about 200ms to call my function which loops over the jsPlumb object which gives the jsPlumb code time to finish up after the connectionDetached event. Obviously this is not great coding on my part as its not guaranteed the jsPlumb object will be finished updating in that amount of time.

Is what is happening desired operation for jsPlumb or is it a bug?

Is there an event that can be bound to on the jsPlumb object that can be called whenever a change has been made to the jsPlumb object itself, such that I could call my loop function by that event?

DedicatedManagers avatar Jun 09 '17 16:06 DedicatedManagers

Is there a solution for this? I'm experiencing the same issue.

abombelli avatar Jan 11 '24 22:01 abombelli