データ取得のフォールバックを強化

This commit is contained in:
kakkokari-gtyih 2024-12-29 12:37:26 +09:00
parent a7d3a34103
commit d66c2a6ac9
1 changed files with 7 additions and 3 deletions

View File

@ -91,12 +91,16 @@ async function prepend(data: Misskey.entities.Note | Misskey.entities.StreamNote
credentials: 'omit', credentials: 'omit',
}); });
if (!res.ok) return; if (!res.ok) return;
fullNote = (await res.json()) as Misskey.entities.Note; fullNote = (await res.json().catch(() => null)) as Misskey.entities.Note | null;
} else { }
// or
if (fullNote == null) {
fullNote = await misskeyApi('notes/show', { fullNote = await misskeyApi('notes/show', {
noteId: data.id, noteId: data.id,
}); }).catch(() => null);
} }
if (fullNote == null) return; if (fullNote == null) return;
note = deepMerge(_data, fullNote); note = deepMerge(_data, fullNote);