#onConnectEnd and onReconnectEnd
1 messages · Page 1 of 1 (latest)
No way it's David K! stately.ai is one of the interfaces I'm getting a lot of inspo from! I didn't realise it's using React Flow. Love using your state machines for collaborative software design!
Sorry I don't have any actual answer 😅 , but my guess would be that the logic is essentially: all reconnections are connections but not all connections are reconnections. So onConnect events are always expected, even when it's a reconnect type connection. 🤷♂️
Hey! Stately isn't using React Flow yet - actually slowly experimenting with migrating to it for now.
But thanks, that's helpful to know; asking because I need to distinguish between making a new edge and reconnecting an existing edge, and having both fire at the same time doesn't help much, but I think I have a workaround
There's a lot of things from Stately that I haven't been able to migrate cleanly to React Flow yet... I may just manually handle those things myself for now
all reconnections are connections but not all connections are reconnections. So onConnect events are always expected, even when it's a reconnect type connection.
That is basically it, yeah.
You can have a boolean ref, reconnectionStart which would turn to true in onReconnectStart and would turn to false in onReconnectEnd.
You can check for this boolean ref inside the onConnectEnd to see if this is a reconnection or a connection.
Okay, I figured as much - a bit hacky but it'll work, thanks!
I agree that the API is a bit confusing here