mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Normalize indices on init
This commit is contained in:
parent
7b36de0476
commit
e4c3744dc4
8 changed files with 112 additions and 31 deletions
|
@ -26,6 +26,7 @@ import {
|
|||
TTDDialogTrigger,
|
||||
StoreAction,
|
||||
reconcileElements,
|
||||
normalizeIndices,
|
||||
} from "../packages/excalidraw";
|
||||
import type {
|
||||
AppState,
|
||||
|
@ -305,14 +306,21 @@ const initializeScene = async (opts: {
|
|||
key: roomLinkData.roomKey,
|
||||
};
|
||||
} else if (scene) {
|
||||
const normalizedScene = {
|
||||
...scene,
|
||||
// non-collab scenes are always always normalized on init
|
||||
// collab scenes are normalized only on "first-in-room" as part of collabAPI
|
||||
elements: normalizeIndices(scene.elements),
|
||||
};
|
||||
|
||||
return isExternalScene && jsonBackendMatch
|
||||
? {
|
||||
scene,
|
||||
scene: normalizedScene,
|
||||
isExternalScene,
|
||||
id: jsonBackendMatch[1],
|
||||
key: jsonBackendMatch[2],
|
||||
}
|
||||
: { scene, isExternalScene: false };
|
||||
: { scene: normalizedScene, isExternalScene: false };
|
||||
}
|
||||
return { scene: null, isExternalScene: false };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue