Skip to content

Commit

Permalink
fix: customInstructions default to be empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
anc95 committed Apr 10, 2023
1 parent caf71ad commit 2255ec8
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/common/store/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,17 @@ export const saveSetting = async (newSettings: Partial<Settings>) => {
}

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
}) || []
}

0 comments on commit 2255ec8

Please sign in to comment.