From 2255ec84192c79efbd3b8643ed0bf2aef8d69837 Mon Sep 17 00:00:00 2001 From: anc95 <1481988258@qq.com> Date: Mon, 10 Apr 2023 13:50:28 +0800 Subject: [PATCH] fix: customInstructions default to be empty array --- src/common/store/settings.ts | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/common/store/settings.ts b/src/common/store/settings.ts index c73ef7c..debbb62 100644 --- a/src/common/store/settings.ts +++ b/src/common/store/settings.ts @@ -78,19 +78,17 @@ export const saveSetting = async (newSettings: Partial) => { } const patchCustomInstructions = (setting: Settings) => { - if (setting.customInstructions) { - setting.customInstructions = - setting.customInstructions?.map((instruction) => { - if (typeof instruction === 'string') { - return { - id: uniqueId(), - name: instruction, - instruction: instruction, - icon: '😄', - } + setting.customInstructions = + setting.customInstructions?.map((instruction) => { + if (typeof instruction === 'string') { + return { + id: uniqueId(), + name: instruction, + instruction: instruction, + icon: '😄', } + } - return instruction - }) || [] - } + return instruction + }) || [] }