delay scene init until document active (#1920)
* delay scene init until document active * use opts.once for the listener
This commit is contained in:
parent
cf36cb394b
commit
b07aa6e205
@ -474,6 +474,14 @@ class App extends React.Component<ExcalidrawProps, AppState> {
|
|||||||
window.history.replaceState({}, "Excalidraw", window.location.origin);
|
window.history.replaceState({}, "Excalidraw", window.location.origin);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// https://github.com/excalidraw/excalidraw/issues/1919
|
||||||
|
if (document.hidden) {
|
||||||
|
window.addEventListener("focus", () => this.initializeScene(), {
|
||||||
|
once: true,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isCollaborationScene = false;
|
isCollaborationScene = false;
|
||||||
window.history.replaceState({}, "Excalidraw", window.location.origin);
|
window.history.replaceState({}, "Excalidraw", window.location.origin);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user