Virtual whiteboard for sketching hand-drawn like diagrams
fix accessing nonexisting config property during appState clearing (#1928)
David Luzar4cfc8bd4b3f1
diff --git a/src/appState.ts b/src/appState.tsindex e10d8813d2..76d2128165 100644--- a/src/appState.ts+++ b/src/appState.ts@@ -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/31445stateForExport[key] = appState[key];}