fix infinite spinner when translation request fails

This commit is contained in:
Hazelnoot 2025-05-12 13:20:30 -04:00
parent 871a4d3fb1
commit 7cf766d44c

View file

@ -293,12 +293,12 @@ export function getNoteMenu(props: {
async function translate(): Promise<void> { async function translate(): Promise<void> {
if (props.translation.value != null) return; if (props.translation.value != null) return;
props.translating.value = true; props.translating.value = true;
const res = await misskeyApi('notes/translate', { props.translation.value = await misskeyApi('notes/translate', {
noteId: appearNote.id, noteId: appearNote.id,
targetLang: miLocalStorage.getItem('lang') ?? navigator.language, targetLang: miLocalStorage.getItem('lang') ?? navigator.language,
}).finally(() => {
props.translating.value = false;
}); });
props.translating.value = false;
props.translation.value = res;
} }
const menuItems: MenuItem[] = []; const menuItems: MenuItem[] = [];