mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
refactor: improve types around dataState and libraryData (#3427)
This commit is contained in:
parent
c19c8ecd27
commit
a7cbe68ae8
10 changed files with 84 additions and 55 deletions
|
@ -245,10 +245,10 @@ const importFromBackend = async (
|
|||
export const loadScene = async (
|
||||
id: string | null,
|
||||
privateKey: string | null,
|
||||
// Supply initialData even if importing from backend to ensure we restore
|
||||
// Supply local state even if importing from backend to ensure we restore
|
||||
// localStorage user settings which we do not persist on server.
|
||||
// Non-optional so we don't forget to pass it even if `undefined`.
|
||||
initialData: ImportedDataState | undefined | null,
|
||||
localDataState: ImportedDataState | undefined | null,
|
||||
) => {
|
||||
let data;
|
||||
if (id != null) {
|
||||
|
@ -256,10 +256,10 @@ export const loadScene = async (
|
|||
// extra care not to leak it
|
||||
data = restore(
|
||||
await importFromBackend(id, privateKey),
|
||||
initialData?.appState,
|
||||
localDataState?.appState,
|
||||
);
|
||||
} else {
|
||||
data = restore(initialData || null, null);
|
||||
data = restore(localDataState || null, null);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue