From 42df058223318c716a8fc1e18ea525830b10189e Mon Sep 17 00:00:00 2001 From: David Luzar Date: Tue, 24 Mar 2020 17:57:59 +0100 Subject: [PATCH] load from localStorage only if not in multiplayer (#1074) --- src/components/App.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index 5bf550a0..eebc085e 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -332,6 +332,7 @@ export class App extends React.Component { 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 { 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() {