applying changes from upstream commits 20e3acf7a6 and 561e919a2e which broke the yarn build (#1)
This commit is contained in:
parent
c4d5da3bf5
commit
8f410897a4
@ -23,7 +23,7 @@ import type { Socket } from "socket.io-client";
|
||||
|
||||
class Portal {
|
||||
collab: TCollabClass;
|
||||
socket: SocketIOClient.Socket | null = null;
|
||||
socket: 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;
|
||||
@ -33,7 +33,7 @@ class Portal {
|
||||
this.collab = collab;
|
||||
}
|
||||
|
||||
open(socket: SocketIOClient.Socket, id: string, key: string) {
|
||||
open(socket: Socket, id: string, key: string) {
|
||||
this.socket = socket;
|
||||
this.roomId = id;
|
||||
this.roomKey = key;
|
||||
|
@ -2,6 +2,7 @@ import { SyncableExcalidrawElement } from ".";
|
||||
import { ExcalidrawElement, FileId } from "../../packages/excalidraw/element/types";
|
||||
import { AppState, BinaryFileData } from "../../packages/excalidraw/types";
|
||||
import Portal from "../collab/Portal";
|
||||
import type { Socket } from "socket.io-client";
|
||||
|
||||
export interface StorageBackend {
|
||||
isSaved: (portal: Portal, elements: readonly ExcalidrawElement[]) => boolean;
|
||||
@ -13,7 +14,7 @@ export interface StorageBackend {
|
||||
loadFromStorageBackend: (
|
||||
roomId: string,
|
||||
roomKey: string,
|
||||
socket: SocketIOClient.Socket | null,
|
||||
socket: Socket | null,
|
||||
) => Promise<readonly ExcalidrawElement[] | null>;
|
||||
saveFilesToStorageBackend: ({
|
||||
prefix,
|
||||
|
@ -21,7 +21,7 @@ import { MIME_TYPES } from "../../packages/excalidraw/constants";
|
||||
import { reconcileElements } from "../collab/reconciliation";
|
||||
import { getSyncableElements, SyncableExcalidrawElement } from ".";
|
||||
import { ResolutionType } from "../../packages/excalidraw/utility-types";
|
||||
import { Socket } from "socket.io-client";
|
||||
import type { Socket } from "socket.io-client";
|
||||
|
||||
// private
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -141,12 +141,12 @@ const decryptElements = async (
|
||||
};
|
||||
|
||||
class FirebaseSceneVersionCache {
|
||||
private static cache = new WeakMap<SocketIOClient.Socket, number>();
|
||||
static get = (socket: SocketIOClient.Socket) => {
|
||||
private static cache = new WeakMap<Socket, number>();
|
||||
static get = (socket: Socket) => {
|
||||
return FirebaseSceneVersionCache.cache.get(socket);
|
||||
};
|
||||
static set = (
|
||||
socket: SocketIOClient.Socket,
|
||||
socket: Socket,
|
||||
elements: readonly SyncableExcalidrawElement[],
|
||||
) => {
|
||||
FirebaseSceneVersionCache.cache.set(socket, getSceneVersion(elements));
|
||||
@ -288,7 +288,7 @@ export const saveToFirebase = async (
|
||||
export const loadFromFirebase = async (
|
||||
roomId: string,
|
||||
roomKey: string,
|
||||
socket: SocketIOClient.Socket | null,
|
||||
socket: Socket | null,
|
||||
): Promise<readonly ExcalidrawElement[] | null> => {
|
||||
const firebase = await loadFirestore();
|
||||
const db = firebase.firestore();
|
||||
|
@ -17,6 +17,7 @@ import {
|
||||
import Portal from "../collab/Portal";
|
||||
import { reconcileElements } from "../collab/reconciliation";
|
||||
import { StoredScene } from "./StorageBackend";
|
||||
import type { Socket } from "socket.io-client";
|
||||
|
||||
const HTTP_STORAGE_BACKEND_URL = import.meta.env.VITE_APP_HTTP_STORAGE_BACKEND_URL;
|
||||
const SCENE_VERSION_LENGTH_BYTES = 4
|
||||
@ -25,7 +26,7 @@ const SCENE_VERSION_LENGTH_BYTES = 4
|
||||
// to prevent modifying upstream files and ease futur maintenance of this fork
|
||||
|
||||
const httpStorageSceneVersionCache = new WeakMap<
|
||||
SocketIOClient.Socket,
|
||||
Socket,
|
||||
number
|
||||
>();
|
||||
|
||||
@ -106,7 +107,7 @@ export const saveToHttpStorage = async (
|
||||
export const loadFromHttpStorage = async (
|
||||
roomId: string,
|
||||
roomKey: string,
|
||||
socket: SocketIOClient.Socket | null,
|
||||
socket: Socket | null,
|
||||
): Promise<readonly ExcalidrawElement[] | null> => {
|
||||
const HTTP_STORAGE_BACKEND_URL = import.meta.env.VITE_APP_HTTP_STORAGE_BACKEND_URL;
|
||||
const getResponse = await fetch(
|
||||
|
Loading…
x
Reference in New Issue
Block a user