feat: add persistent cache for following feed and notifications
This commit is contained in:
parent
7a9c777744
commit
fd9f41c8f4
10 changed files with 268 additions and 102 deletions
|
|
@ -65,8 +65,6 @@ export function useInfiniteScroll<T>({
|
|||
const loadMore = useCallback(async () => {
|
||||
const { loading, hasMore, showCount, itemsLength, initialLoading } = stateRef.current
|
||||
|
||||
if (initialLoading || loading) return
|
||||
|
||||
// If there are more items to show, increase showCount first
|
||||
if (showCount < itemsLength) {
|
||||
setShowCount((prev) => prev + initialShowCount)
|
||||
|
|
@ -76,6 +74,8 @@ export function useInfiniteScroll<T>({
|
|||
}
|
||||
}
|
||||
|
||||
if (initialLoading || loading) return
|
||||
|
||||
if (!hasMore) return
|
||||
setLoading(true)
|
||||
const newHasMore = await onLoadMore()
|
||||
|
|
@ -114,6 +114,7 @@ export function useInfiniteScroll<T>({
|
|||
shouldShowLoadingIndicator,
|
||||
bottomRef,
|
||||
setHasMore,
|
||||
setLoading
|
||||
setLoading,
|
||||
setShowCount
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue