I am developing a real time collaborative diagram editor. At the moment I am trying to implement the use case when a user sees a node is moved by another user. I thought that the EventListener positionChanged would be a nice fit for this use case. The Code looks like this:
When adding a node i add an EventListener. In there i change the state of serializedModel.
I am developing a real time collaborative diagram editor. At the moment I am trying to implement the use case when a user sees a node is moved by another user. I thought that the EventListener positionChanged would be a nice fit for this use case. The Code looks like this:
When adding a node i add an EventListener. In there i change the state of
serializedModel
.serializedModel
is just the return value ofmodel.serialize()
.Then there is this
useEffect
:In here a just send a message to my backend to synchronize with the other users.
The Problem right now is that the EventListener only works for a few seconds:![image](https://github.com/projectstorm/react-diagrams/assets/65312550/50492009-4af9-43b7-934a-93b816f88d61)
But when i do not set a state in the EventListener. So something likes this:
It works![image](https://github.com/projectstorm/react-diagrams/assets/65312550/b790b060-debb-4f22-add9-cfcc3483754a)