feat: support updating appState in updateScene API (#3576)

* feat: support updating appState in updateScene API

* make `updateScene.data.appState` more type-safe

* restore `appState` when passing to `updateScene`

* fix

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
Aakansha Doshi 2021-05-14 17:52:56 +05:30 committed by GitHub
parent f1cf28a84e
commit 78da4c075e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 21 deletions

View file

@ -51,7 +51,7 @@ import {
saveToLocalStorage,
} from "./data/localStorage";
import CustomStats from "./CustomStats";
import { RestoredDataState } from "../data/restore";
import { restoreAppState, RestoredDataState } from "../data/restore";
const languageDetector = new LanguageDetector();
languageDetector.init({
@ -239,7 +239,10 @@ const ExcalidrawWrapper = () => {
} else {
initializeScene({ collabAPI }).then((scene) => {
if (scene) {
excalidrawAPI.updateScene(scene);
excalidrawAPI.updateScene({
...scene,
appState: restoreAppState(scene.appState, null),
});
}
});
}