From 1704c0401c29ff7debbd9aa12165277b48228902 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Sat, 7 Jan 2023 11:32:50 +0100 Subject: [PATCH] Fix remote toot level is not applied --- src/screens/Tabs/Shared/Toot.tsx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/screens/Tabs/Shared/Toot.tsx b/src/screens/Tabs/Shared/Toot.tsx index 8364db05..36c1859d 100644 --- a/src/screens/Tabs/Shared/Toot.tsx +++ b/src/screens/Tabs/Shared/Toot.tsx @@ -94,11 +94,13 @@ const TabSharedToot: React.FC> = ({ { body: statuses.map((status, index) => { if (index < highlightIndex.current || status.id === toot.id) { - return { ...status, _level: 0 } + status._level = 0 + return status } else { const repliedLevel: number = statuses.find(s => s.id === status.in_reply_to_id)?._level || 0 - return { ...status, _level: repliedLevel + 1 } + status._level = repliedLevel + 1 + return status } }) } @@ -169,11 +171,13 @@ const TabSharedToot: React.FC> = ({ return statuses.map((status, index) => { if (index < highlightIndex.current || status.id === toot.id) { - return { ...status, _level: 0 } + status._level = 0 + return status } const repliedLevel: number = statuses.find(s => s.id === status.in_reply_to_id)?._level || 0 - return { ...status, _level: repliedLevel + 1 } + status._level = repliedLevel + 1 + return status }) }, { @@ -206,7 +210,7 @@ const TabSharedToot: React.FC> = ({ ) if (localMatch) { delete localMatch.key - return localMatch + return { ...localMatch, _level: remote._level } } else { return { ...remote, @@ -372,8 +376,8 @@ const TabSharedToot: React.FC> = ({ } }) : null} - {/* > = ({ style={{ position: 'absolute', top: 20, left: 4, color: colors.yellow }} /> */} + /> ) }}