Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

delay scene init until document active (#1920)

David Luzarb07aa6e20594
diff --git a/src/components/App.tsx b/src/components/App.tsx
index 5c8c0df844..be3b2c99b7 100644
--- a/src/components/App.tsx
+++ b/src/components/App.tsx
@@ -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);
}