This commit is contained in:
Aakansha Doshi 2021-02-20 02:22:40 +05:30
parent dcedba88a2
commit bba0117377
1 changed files with 7 additions and 4 deletions

View File

@ -181,14 +181,18 @@ function ExcalidrawWrapper() {
}
initializeScene({ collabAPI }).then((scene) => {
setViewModeEnabled(!!scene?.appState?.viewModeEnabled);
if (scene?.appState?.viewModeEnabled) {
setViewModeEnabled(true);
}
initialStatePromiseRef.current.promise.resolve(scene);
});
const onHashChange = (_: HashChangeEvent) => {
initializeScene({ collabAPI }).then((scene) => {
if (scene) {
setViewModeEnabled(!!scene.appState?.viewModeEnabled);
if (scene?.appState?.viewModeEnabled) {
setViewModeEnabled(true);
}
excalidrawAPI.updateScene(scene);
}
});
@ -282,7 +286,6 @@ function ExcalidrawWrapper() {
},
[langCode],
);
return (
<>
<Excalidraw
@ -297,7 +300,7 @@ function ExcalidrawWrapper() {
onExportToBackend={onExportToBackend}
renderFooter={renderFooter}
langCode={langCode}
viewModeEnabled={viewModeEnabled}
viewModeEnabled={viewModeEnabled ? viewModeEnabled : undefined}
/>
{excalidrawAPI && <CollabWrapper excalidrawAPI={excalidrawAPI} />}
{errorMessage && (