From c2aa78fef8c8f3250b110fa54d25d2f3e449fc49 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Fri, 6 Jan 2023 18:38:52 +0100 Subject: [PATCH] Fix highlighted toot cannot be actioned --- src/screens/Tabs/Shared/Toot.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/screens/Tabs/Shared/Toot.tsx b/src/screens/Tabs/Shared/Toot.tsx index 2624b2df..8364db05 100644 --- a/src/screens/Tabs/Shared/Toot.tsx +++ b/src/screens/Tabs/Shared/Toot.tsx @@ -74,7 +74,7 @@ const TabSharedToot: React.FC> = ({ const match = urlMatcher(toot.url || toot.uri) const highlightIndex = useRef(0) - const query = useQuery<{ pages: { body: (Mastodon.Status & { _key?: 'cached' })[] }[] }>( + const query = useQuery<{ pages: { body: (Mastodon.Status & { key?: 'cached' })[] }[] }>( queryKey.local, async () => { const context = await apiInstance<{ @@ -106,7 +106,7 @@ const TabSharedToot: React.FC> = ({ } }, { - initialData: { pages: [{ body: [{ ...toot, _level: 0, _key: 'cached' }] }] }, + initialData: { pages: [{ body: [{ ...toot, _level: 0, key: 'cached' }] }] }, enabled: !toot._remote, staleTime: 0, refetchOnMount: true, @@ -205,7 +205,7 @@ const TabSharedToot: React.FC> = ({ local => local.uri === remote.uri ) if (localMatch) { - delete localMatch._key + delete localMatch.key return localMatch } else { return { @@ -263,7 +263,7 @@ const TabSharedToot: React.FC> = ({ ref={flRef} scrollEventThrottle={16} windowSize={7} - data={query.data.pages?.[0].body} + data={query.data?.pages?.[0].body} renderItem={({ item, index }) => { const prev = query.data.pages[0].body[index - 1]?._level || 0 const curr = item._level