mirror of
https://github.com/tooot-app/app
synced 2025-04-19 04:37:24 +02:00
Fix cached toot not replaced
This commit is contained in:
parent
3883c0307a
commit
e97eff25c5
@ -34,7 +34,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
|||||||
remote: ['Timeline', { page: 'Toot', toot: toot.id, remote: true }]
|
remote: ['Timeline', { page: 'Toot', toot: toot.id, remote: true }]
|
||||||
}
|
}
|
||||||
|
|
||||||
const flRef = useRef<FlatList<Mastodon.Status & { _level?: number }>>(null)
|
const flRef = useRef<FlatList<Mastodon.Status & { _level?: number; key?: string }>>(null)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
navigation.setOptions({
|
navigation.setOptions({
|
||||||
@ -72,11 +72,13 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
|||||||
}, [hasRemoteContent])
|
}, [hasRemoteContent])
|
||||||
|
|
||||||
const PREV_PER_BATCH = 1
|
const PREV_PER_BATCH = 1
|
||||||
const ancestorsCache = useRef<(Mastodon.Status & { _level?: number })[]>()
|
const ancestorsCache = useRef<(Mastodon.Status & { _level?: number; key?: string })[]>()
|
||||||
const loaded = useRef<boolean>(false)
|
const loaded = useRef<boolean>(false)
|
||||||
|
|
||||||
const match = urlMatcher(toot.url || toot.uri)
|
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,
|
queryKey.local,
|
||||||
async () => {
|
async () => {
|
||||||
const context = await apiInstance<{
|
const context = await apiInstance<{
|
||||||
@ -109,7 +111,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
placeholderData: { pages: [{ body: [{ ...toot, _level: 0 }] }] },
|
placeholderData: { pages: [{ body: [{ ...toot, _level: 0, key: `${toot.id}_cache` }] }] },
|
||||||
enabled: !toot._remote,
|
enabled: !toot._remote,
|
||||||
staleTime: 0,
|
staleTime: 0,
|
||||||
refetchOnMount: true,
|
refetchOnMount: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user