feat: expose StoreAction in relation to multiplayer history (#7898)

Improved Store API and improved handling of actions to eliminate potential concurrency issues
This commit is contained in:
Marcel Mraz 2024-04-22 10:22:25 +01:00 committed by GitHub
parent 530617be90
commit 015b46ab23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 341 additions and 190 deletions

View file

@ -26,7 +26,8 @@ import {
LiveCollaborationTrigger,
TTDDialog,
TTDDialogTrigger,
} from "../packages/excalidraw/index";
StoreAction,
} from "../packages/excalidraw";
import {
AppState,
ExcalidrawImperativeAPI,
@ -438,7 +439,7 @@ const ExcalidrawWrapper = () => {
excalidrawAPI.updateScene({
...data.scene,
...restore(data.scene, null, null, { repairBindings: true }),
commitToStore: true,
storeAction: StoreAction.CAPTURE,
});
}
});
@ -469,6 +470,7 @@ const ExcalidrawWrapper = () => {
setLangCode(langCode);
excalidrawAPI.updateScene({
...localDataState,
storeAction: StoreAction.UPDATE,
});
LibraryIndexedDBAdapter.load().then((data) => {
if (data) {
@ -604,6 +606,7 @@ const ExcalidrawWrapper = () => {
if (didChange) {
excalidrawAPI.updateScene({
elements,
storeAction: StoreAction.UPDATE,
});
}
}