feat: use userId instead of socketId

This commit is contained in:
Arnošt Pleskot 2023-07-12 16:56:21 +02:00
parent 62df03d78d
commit 2bdf09153c
No known key found for this signature in database
5 changed files with 47 additions and 31 deletions

View file

@ -20,6 +20,7 @@ import { unstable_batchedUpdates } from "react-dom";
import { SHAPES } from "./shapes";
import { isEraserActive, isHandToolActive } from "./appState";
import { ResolutionType } from "./utility-types";
import { reconcileElements } from "./excalidraw-app/collab/reconciliation";
let mockDateTime: string | null = null;
@ -907,3 +908,14 @@ export const isOnlyExportingSingleFrame = (
)
);
};
export const upsertMap = <T>(key: T, value: object, map: Map<T, object>) => {
if (!map.has(key)) {
map.set(key, value);
} else {
const old = map.get(key);
map.set(key, { ...old, ...value });
}
return map;
};