fix: remove CRDT observer feedback loop causing drag issues

The Yjs map observers were calling notifyNodesChange/notifyEdgesChange
for local changes, creating a feedback loop that reset React Flow state
mid-drag. Remote notifications are already handled by the connectChannel
handler, so the observers only need to schedule persistence.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Gustavo Henrique Santos Souza de Miranda 2026-01-23 20:54:45 -03:00
parent fa336f05d9
commit 6bc4e32fde
1 changed files with 1 additions and 3 deletions

View File

@ -27,16 +27,14 @@ export class CRDTManager {
this.edgesMap = this.doc.getMap('edges') this.edgesMap = this.doc.getMap('edges')
this.callbacks = callbacks this.callbacks = callbacks
// Listen for remote Yjs document changes // Schedule persistence on local Yjs document changes
this.nodesMap.observe(() => { this.nodesMap.observe(() => {
if (this.isApplyingRemote) return if (this.isApplyingRemote) return
this.notifyNodesChange()
this.schedulePersist() this.schedulePersist()
}) })
this.edgesMap.observe(() => { this.edgesMap.observe(() => {
if (this.isApplyingRemote) return if (this.isApplyingRemote) return
this.notifyEdgesChange()
this.schedulePersist() this.schedulePersist()
}) })