mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
fix accessing nonexisting config property during appState clearing (#1928)
This commit is contained in:
parent
f9793835e6
commit
4cfc8bd4b3
1 changed files with 7 additions and 1 deletions
|
@ -139,7 +139,13 @@ const _clearAppStateForStorage = <ExportType extends "export" | "browser">(
|
|||
}[keyof typeof APP_STATE_STORAGE_CONF];
|
||||
const stateForExport = {} as { [K in ExportableKeys]?: typeof appState[K] };
|
||||
for (const key of Object.keys(appState) as (keyof typeof appState)[]) {
|
||||
if (APP_STATE_STORAGE_CONF[key][exportType]) {
|
||||
const propConfig = APP_STATE_STORAGE_CONF[key];
|
||||
if (!propConfig) {
|
||||
console.error(
|
||||
`_clearAppStateForStorage: appState key "${key}" config doesn't exist for "${exportType}" export type`,
|
||||
);
|
||||
}
|
||||
if (propConfig?.[exportType]) {
|
||||
// @ts-ignore see https://github.com/microsoft/TypeScript/issues/31445
|
||||
stateForExport[key] = appState[key];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue