From ebdbb02e4788e210f9a12bb4672b0f8ad590e023 Mon Sep 17 00:00:00 2001 From: emmanuelryan-gamla Date: Mon, 18 Dec 2023 23:12:44 +0800 Subject: [PATCH] Fix TypeScript errors --- src/store/databases/reducer.ts | 5 ++++- src/store/databases/types.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/store/databases/reducer.ts b/src/store/databases/reducer.ts index 47b17eb..304ca23 100644 --- a/src/store/databases/reducer.ts +++ b/src/store/databases/reducer.ts @@ -269,7 +269,10 @@ export default function databaseReducer( }; case APPEND_CONFIGURED_FORM: return produce(state, (draft: DBState) => { - draft.forms[action.payload.formIndex].formModes.push(action.payload.data); + const formModes = draft.forms[action.payload.formIndex].formModes; + if (formModes !== undefined) { + formModes.push(action.payload.data); + } }); case UNCONFIG_FORM: return produce(state, (draft: DBState) => { diff --git a/src/store/databases/types.ts b/src/store/databases/types.ts index 30a74f4..228d843 100644 --- a/src/store/databases/types.ts +++ b/src/store/databases/types.ts @@ -120,7 +120,7 @@ export interface DBState { dbName: string; formName: string; alias: Array; - formModes: Array; + formModes?: Array; formAccessModes: Array; }>; loadedForm: string;