fix: do not fire pause logic on window focus/blur event

This commit is contained in:
Arnošt Pleskot 2023-06-02 10:25:58 +02:00
parent addf9d71fa
commit 52254bca7c
No known key found for this signature in database
2 changed files with 3 additions and 0 deletions

View File

@ -334,6 +334,7 @@ class Collab extends PureComponent<Props, CollabState> {
if (this.portal.socket) {
this.reportActive();
this.portal.socket.connect();
this.portal.socketInitialized = true;
this.setIsCollaborationPaused(false);
if (callback) {

View File

@ -476,7 +476,9 @@ const ExcalidrawWrapper = () => {
event.type === EVENT.FOCUS
) {
syncData();
}
if (event.type === EVENT.VISIBILITY_CHANGE) {
switch (true) {
// user switches to another tab
case document.hidden && collabAPI.isCollaborating():