mirror of
https://github.com/tooot-app/app
synced 2025-02-08 16:08:44 +01:00
Refine remote logic
When loading remote ancestors, the position might not be kept
This commit is contained in:
parent
b5ddebe123
commit
bfe37db9b6
@ -111,12 +111,13 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
flRef.current?.props.data?.length && setTimeout(() => {
|
flRef.current?.props.data?.length &&
|
||||||
flRef.current?.scrollToIndex({
|
setTimeout(() => {
|
||||||
index: ancestorsCache.current?.length || 0,
|
flRef.current?.scrollToIndex({
|
||||||
viewOffset: 50
|
index: ancestorsCache.current?.length || 0,
|
||||||
})
|
viewOffset: 50
|
||||||
}, 50)
|
})
|
||||||
|
}, 50)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,14 +237,8 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((query.data?.pages[0].body.length || 0) <= data.length) {
|
if ((query.data?.pages[0].body.length || 0) < data.length) {
|
||||||
if (
|
setHasRemoteContent(true)
|
||||||
!hasRemoteContent &&
|
|
||||||
(query.data?.pages[0].body.length || 0) <= data.length &&
|
|
||||||
data.length > 1
|
|
||||||
) {
|
|
||||||
setHasRemoteContent(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
queryClient.cancelQueries(queryKey.local)
|
queryClient.cancelQueries(queryKey.local)
|
||||||
queryClient.setQueryData<{ pages: { body: Mastodon.Status[] }[] }>(
|
queryClient.setQueryData<{ pages: { body: Mastodon.Status[] }[] }>(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user