From 0c18d4e0582311879c16d4306697ae8debb82a31 Mon Sep 17 00:00:00 2001 From: hjlarry Date: Tue, 13 Jan 2026 15:59:59 +0800 Subject: [PATCH] fix duplicated status --- .../core/collaboration-manager.ts | 29 +++---------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/web/app/components/workflow/collaboration/core/collaboration-manager.ts b/web/app/components/workflow/collaboration/core/collaboration-manager.ts index 669601e819..9751195c7f 100644 --- a/web/app/components/workflow/collaboration/core/collaboration-manager.ts +++ b/web/app/components/workflow/collaboration/core/collaboration-manager.ts @@ -956,7 +956,7 @@ export class CollaborationManager { } }) - socket.on('status', (data: any) => { + socket.on('status', (data: { isLeader: boolean }) => { try { if (!data || typeof data.isLeader !== 'boolean') { console.warn('Invalid status data:', data) @@ -966,6 +966,9 @@ export class CollaborationManager { const wasLeader = this.isLeader this.isLeader = data.isLeader + if (wasLeader !== this.isLeader) + console.log(`Collaboration: I am now the ${this.isLeader ? 'Leader' : 'Follower'}.`) + if (this.isLeader) this.pendingInitialSync = false else @@ -979,30 +982,6 @@ export class CollaborationManager { } }) - socket.on('status', (data: { isLeader: boolean }) => { - if (this.isLeader !== data.isLeader) { - this.isLeader = data.isLeader - console.log(`Collaboration: I am now the ${this.isLeader ? 'Leader' : 'Follower'}.`) - this.eventEmitter.emit('leaderChange', this.isLeader) - } - if (this.isLeader) - this.pendingInitialSync = false - else - this.requestInitialSyncIfNeeded() - }) - - socket.on('status', (data: { isLeader: boolean }) => { - if (this.isLeader !== data.isLeader) { - this.isLeader = data.isLeader - console.log(`Collaboration: I am now the ${this.isLeader ? 'Leader' : 'Follower'}.`) - this.eventEmitter.emit('leaderChange', this.isLeader) - } - if (this.isLeader) - this.pendingInitialSync = false - else - this.requestInitialSyncIfNeeded() - }) - socket.on('connect', () => { console.log('WebSocket connected successfully') this.eventEmitter.emit('stateChange', { isConnected: true })