Ver código fonte

load from localStorage only if not in multiplayer (#1074)

David Luzar 5 anos atrás
pai
commit
42df058223
1 arquivos alterados com 3 adições e 4 exclusões
  1. 3 4
      src/components/App.tsx

+ 3 - 4
src/components/App.tsx

@@ -332,6 +332,7 @@ export class App extends React.Component<any, AppState> {
       false,
     );
     document.addEventListener("gestureend", this.onGestureEnd as any, false);
+    window.addEventListener("beforeunload", this.beforeUnload);
 
     const searchParams = new URLSearchParams(window.location.search);
     const id = searchParams.get("id");
@@ -351,16 +352,14 @@ export class App extends React.Component<any, AppState> {
       return;
     }
 
-    const scene = await loadScene(null);
-    this.syncActionResult(scene);
-
     const roomMatch = getCollaborationLinkData(window.location.href);
     if (roomMatch) {
       this.initializeSocketClient();
       return;
     }
 
-    window.addEventListener("beforeunload", this.beforeUnload);
+    const scene = await loadScene(null);
+    this.syncActionResult(scene);
   }
 
   public componentWillUnmount() {