diff --git a/src/excalidraw-app/collab/Collab.tsx b/src/excalidraw-app/collab/Collab.tsx index 6b03d4239..1cadd0eae 100644 --- a/src/excalidraw-app/collab/Collab.tsx +++ b/src/excalidraw-app/collab/Collab.tsx @@ -334,6 +334,7 @@ class Collab extends PureComponent { if (this.portal.socket) { this.reportActive(); this.portal.socket.connect(); + this.portal.socketInitialized = true; this.setIsCollaborationPaused(false); if (callback) { diff --git a/src/excalidraw-app/index.tsx b/src/excalidraw-app/index.tsx index dd1b383db..051e1f76a 100644 --- a/src/excalidraw-app/index.tsx +++ b/src/excalidraw-app/index.tsx @@ -476,7 +476,9 @@ const ExcalidrawWrapper = () => { event.type === EVENT.FOCUS ) { syncData(); + } + if (event.type === EVENT.VISIBILITY_CHANGE) { switch (true) { // user switches to another tab case document.hidden && collabAPI.isCollaborating():