diff --git a/src/screens/Tabs/Shared/Toot.tsx b/src/screens/Tabs/Shared/Toot.tsx index cb17dc81..e40147e0 100644 --- a/src/screens/Tabs/Shared/Toot.tsx +++ b/src/screens/Tabs/Shared/Toot.tsx @@ -34,7 +34,7 @@ const TabSharedToot: React.FC> = ({ remote: ['Timeline', { page: 'Toot', toot: toot.id, remote: true }] } - const flRef = useRef>(null) + const flRef = useRef>(null) useEffect(() => { navigation.setOptions({ @@ -72,11 +72,13 @@ const TabSharedToot: React.FC> = ({ }, [hasRemoteContent]) const PREV_PER_BATCH = 1 - const ancestorsCache = useRef<(Mastodon.Status & { _level?: number })[]>() + const ancestorsCache = useRef<(Mastodon.Status & { _level?: number; key?: string })[]>() const loaded = useRef(false) const match = urlMatcher(toot.url || toot.uri) - const query = useQuery<{ pages: { body: (Mastodon.Status & { _level?: number })[] }[] }>( + const query = useQuery<{ + pages: { body: (Mastodon.Status & { _level?: number; key?: string })[] }[] + }>( queryKey.local, async () => { const context = await apiInstance<{ @@ -109,7 +111,7 @@ const TabSharedToot: React.FC> = ({ } }, { - placeholderData: { pages: [{ body: [{ ...toot, _level: 0 }] }] }, + placeholderData: { pages: [{ body: [{ ...toot, _level: 0, key: `${toot.id}_cache` }] }] }, enabled: !toot._remote, staleTime: 0, refetchOnMount: true,