From ff35c458c3a625578c632294a4dd8657baa71457 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Tue, 30 Jan 2024 18:57:28 +0800 Subject: [PATCH] Don't return --- src/utils/timeline-utils.jsx | 45 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/utils/timeline-utils.jsx b/src/utils/timeline-utils.jsx index 612dd7d..d41be58 100644 --- a/src/utils/timeline-utils.jsx +++ b/src/utils/timeline-utils.jsx @@ -178,30 +178,29 @@ export function groupContext(items, instance) { if (item.inReplyToId && item.inReplyToAccountId !== item.account.id) { const sKey = statusKey(item.id, instance); - if (states.statusReply[sKey]) { - return; + if (!states.statusReply[sKey]) { + // If it's a reply and not a thread + queueMicrotask(async () => { + try { + const { masto } = api({ instance }); + // const replyToStatus = await masto.v1.statuses + // .$select(item.inReplyToId) + // .fetch(); + const replyToStatus = await fetchStatus(item.inReplyToId, masto); + saveStatus(replyToStatus, instance, { + skipThreading: true, + skipUnfurling: true, + }); + states.statusReply[sKey] = { + id: replyToStatus.id, + instance, + }; + } catch (e) { + // Silently fail + console.error(e); + } + }); } - // If it's a reply and not a thread - queueMicrotask(async () => { - try { - const { masto } = api({ instance }); - // const replyToStatus = await masto.v1.statuses - // .$select(item.inReplyToId) - // .fetch(); - const replyToStatus = await fetchStatus(item.inReplyToId, masto); - saveStatus(replyToStatus, instance, { - skipThreading: true, - skipUnfurling: true, - }); - states.statusReply[sKey] = { - id: replyToStatus.id, - instance, - }; - } catch (e) { - // Silently fail - console.error(e); - } - }); } newItems.push(item);