Explorar el Código

fix: do not fire pause logic on window focus/blur event

Arnošt Pleskot hace 2 años
padre
commit
52254bca7c
Se han modificado 2 ficheros con 3 adiciones y 0 borrados
  1. 1 0
      src/excalidraw-app/collab/Collab.tsx
  2. 2 0
      src/excalidraw-app/index.tsx

+ 1 - 0
src/excalidraw-app/collab/Collab.tsx

@@ -334,6 +334,7 @@ class Collab extends PureComponent<Props, CollabState> {
     if (this.portal.socket) {
       this.reportActive();
       this.portal.socket.connect();
+      this.portal.socketInitialized = true;
       this.setIsCollaborationPaused(false);
 
       if (callback) {

+ 2 - 0
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():