1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Try to fix refetch

This commit is contained in:
Zhiyuan Zheng
2021-03-06 17:55:13 +01:00
parent 89ca588116
commit 17f15a199c
3 changed files with 55 additions and 24 deletions

View File

@ -62,11 +62,15 @@ const Timeline: React.FC<Props> = ({
android: ['dataUpdatedAt', 'isFetching', 'isLoading']
}),
getNextPageParam: lastPage =>
lastPage?.links?.next && { max_id: lastPage.links.next }
lastPage?.links?.next && {
max_id: lastPage.links.next
}
}
})
const flattenData = data?.pages ? data.pages.flatMap(d => [...d.body]) : []
const flattenData = data?.pages
? data.pages.flatMap(page => [...page.body])
: []
const ItemSeparatorComponent = useCallback(
({ leadingItem }) =>
@ -134,7 +138,7 @@ const Timeline: React.FC<Props> = ({
ref={customFLRef || flRef}
scrollEventThrottle={16}
onScroll={onScroll}
windowSize={8}
windowSize={10}
data={flattenData}
initialNumToRender={6}
maxToRenderPerBatch={3}