From a1d3350131ccf5c6fb2affee52c1a5467e52f593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arno=C5=A1t=20Pleskot?= Date: Tue, 27 Jun 2023 17:17:12 +0200 Subject: [PATCH] fix: connect users when resumed from firebase --- src/excalidraw-app/collab/Collab.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/excalidraw-app/collab/Collab.tsx b/src/excalidraw-app/collab/Collab.tsx index e3f21aac7..43810588c 100644 --- a/src/excalidraw-app/collab/Collab.tsx +++ b/src/excalidraw-app/collab/Collab.tsx @@ -385,13 +385,11 @@ class Collab extends PureComponent { this.portal.socket.on("first-in-room", () => { if (this.portal.socket) { this.portal.socket.off("first-in-room"); + // Recall init event to initialize collab with other users (fixes https://github.com/excalidraw/excalidraw/pull/6638#issuecomment-1600799080) + this.portal.socket.emit(WS_SCENE_EVENT_TYPES.INIT); } fallbackResumeHandler(); - - if (this.fallbackResumeTimeout) { - clearTimeout(this.fallbackResumeTimeout); - } }); } @@ -403,6 +401,11 @@ class Collab extends PureComponent { break; } case PauseCollaborationState.SYNCED: { + if (this.fallbackResumeTimeout) { + clearTimeout(this.fallbackResumeTimeout); + this.fallbackResumeTimeout = null; + } + if (this.isPaused()) { this.setIsCollaborationPaused(false); @@ -410,11 +413,7 @@ class Collab extends PureComponent { appState: { viewModeEnabled: false }, }); this.excalidrawAPI.setToast(null); - - if (this.fallbackResumeTimeout) { - clearTimeout(this.fallbackResumeTimeout); - this.fallbackResumeTimeout = null; - } + this.excalidrawAPI.scrollToContent(); } } }