feat: collab component state handling rewrite & fixes (#5046)

This commit is contained in:
David Luzar
2022-07-05 16:03:40 +02:00
committed by GitHub
parent a1a62468a6
commit dac8dda4d4
10 changed files with 227 additions and 192 deletions

View File

@@ -4,7 +4,7 @@ import {
SocketUpdateDataSource,
} from "../data";
import CollabWrapper from "./CollabWrapper";
import { TCollabClass } from "./Collab";
import { ExcalidrawElement } from "../../element/types";
import {
@@ -20,14 +20,14 @@ import { BroadcastedExcalidrawElement } from "./reconciliation";
import { encryptData } from "../../data/encryption";
class Portal {
collab: CollabWrapper;
collab: TCollabClass;
socket: SocketIOClient.Socket | null = null;
socketInitialized: boolean = false; // we don't want the socket to emit any updates until it is fully initialized
roomId: string | null = null;
roomKey: string | null = null;
broadcastedElementVersions: Map<string, number> = new Map();
constructor(collab: CollabWrapper) {
constructor(collab: TCollabClass) {
this.collab = collab;
}