fix: properly set recentlyUsedPostLanguages to registry

This commit is contained in:
sup39 2023-12-27 21:07:20 +09:00
parent f676cc1f19
commit f993467015
Signed by: sup39
GPG key ID: 111C00916C1641E5

View file

@ -1090,13 +1090,21 @@ async function post() {
const languages = Object.keys(langmap); const languages = Object.keys(langmap);
const maxLength = 6; const maxLength = 6;
defaultStore.state.recentlyUsedPostLanguages = [language.value] defaultStore.set(
.concat( "recentlyUsedPostLanguages",
defaultStore.state.recentlyUsedPostLanguages.filter((lang) => { [language.value]
return lang !== language.value && languages.includes(lang); .concat(
}), defaultStore.state.recentlyUsedPostLanguages.filter(
) (lang) => {
.slice(0, maxLength); return (
lang !== language.value &&
languages.includes(lang)
);
},
),
)
.slice(0, maxLength),
);
} }
} }