mirror of https://github.com/tooot-app/app
Delay prepending to make sure it works
This commit is contained in:
parent
5b670f5d13
commit
21200a7758
|
@ -77,6 +77,8 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
const ancestorsCache = useRef<(Mastodon.Status & { _level?: number })[]>()
|
const ancestorsCache = useRef<(Mastodon.Status & { _level?: number })[]>()
|
||||||
const loaded = useRef<boolean>(false)
|
const loaded = useRef<boolean>(false)
|
||||||
const prependContent = async () => {
|
const prependContent = async () => {
|
||||||
|
await new Promise<void>(promise => setTimeout(promise, 128))
|
||||||
|
|
||||||
loaded.current = true
|
loaded.current = true
|
||||||
|
|
||||||
if (ancestorsCache.current?.length) {
|
if (ancestorsCache.current?.length) {
|
||||||
|
@ -173,14 +175,14 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
enabled: !toot._remote,
|
enabled: !toot._remote,
|
||||||
staleTime: 0,
|
staleTime: 0,
|
||||||
refetchOnMount: true,
|
refetchOnMount: true,
|
||||||
onSuccess: async data => {
|
onSuccess: data => {
|
||||||
if (data.pages[0].body.length < 1) {
|
if (data.pages[0].body.length < 1) {
|
||||||
navigation.goBack()
|
navigation.goBack()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!remoteQueryEnabled) {
|
if (!remoteQueryEnabled) {
|
||||||
await prependContent()
|
prependContent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,9 +297,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSettled: async () => {
|
onSettled: () => prependContent()
|
||||||
await prependContent()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue