mirror of
https://github.com/tooot-app/app
synced 2025-01-18 12:15:42 +01:00
Update Toot.tsx
This commit is contained in:
parent
d68ec113c6
commit
1918274ec9
@ -162,7 +162,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
|||||||
}).then(res => res.body)
|
}).then(res => res.body)
|
||||||
|
|
||||||
if (!context?.ancestors.length && !context?.descendants.length) {
|
if (!context?.ancestors.length && !context?.descendants.length) {
|
||||||
return Promise.resolve([])
|
return Promise.resolve([{ ...toot }])
|
||||||
}
|
}
|
||||||
|
|
||||||
highlightIndex.current = context.ancestors.length
|
highlightIndex.current = context.ancestors.length
|
||||||
@ -193,12 +193,12 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((query.data?.pages[0].body.length || 0) - 1 <= data.length) {
|
if ((query.data?.pages[0].body.length || 0) < data.length) {
|
||||||
queryClient.cancelQueries(queryKey.local)
|
queryClient.cancelQueries(queryKey.local)
|
||||||
queryClient.setQueryData<{
|
queryClient.setQueryData<{
|
||||||
pages: { body: Mastodon.Status[] }[]
|
pages: { body: Mastodon.Status[] }[]
|
||||||
}>(queryKey.local, old => {
|
}>(queryKey.local, old => {
|
||||||
if (!old) return { pages: [{ body: [toot] }] }
|
if (!old) return old
|
||||||
|
|
||||||
setHasRemoteContent(true)
|
setHasRemoteContent(true)
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user