From 16c16887ae2654803c9c62148e75e9a378babdea Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Sun, 14 Jul 2024 16:54:16 +0800 Subject: [PATCH] Improve prompt store lang sorting --- app/store/prompt.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/store/prompt.ts b/app/store/prompt.ts index a25cda581..92ff8b370 100644 --- a/app/store/prompt.ts +++ b/app/store/prompt.ts @@ -154,10 +154,10 @@ export const usePromptStore = createPersistStore( fetch(PROMPT_URL) .then((res) => res.json()) .then((res) => { - let fetchPrompts = [res.en, res.tw, res.cn]; - if (getLang() === "cn") { - fetchPrompts = fetchPrompts.reverse(); - } + const lang = getLang(); + const fetchPrompts = [res[lang], res.en, res.tw, res.cn].filter( + Boolean, + ); const builtinPrompts = fetchPrompts.map((promptList: PromptList) => { return promptList.map( ([title, content]) =>