Skip to content

Commit

Permalink
delay scene init until document active (excalidraw#1920)
Browse files Browse the repository at this point in the history
* delay scene init until document active

* use opts.once for the listener
  • Loading branch information
dwelle authored Jul 20, 2020
1 parent cf36cb3 commit b07aa6e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,14 @@ class App extends React.Component<ExcalidrawProps, AppState> {
window.history.replaceState({}, "Excalidraw", window.location.origin);
}
} else {
// https://github.com/excalidraw/excalidraw/issues/1919
if (document.hidden) {
window.addEventListener("focus", () => this.initializeScene(), {
once: true,
});
return;
}

isCollaborationScene = false;
window.history.replaceState({}, "Excalidraw", window.location.origin);
}
Expand Down

0 comments on commit b07aa6e

Please sign in to comment.