Skip to content

Commit a29d881

Browse files
committed
tweaks
1 parent 42a9dc6 commit a29d881

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

packages/react-db/src/useLiveInfiniteQuery.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ export function useLiveInfiniteQuery<TContext extends Context>(
148148
}, [queryResult.data, loadedPageCount, pageSize, initialPageParam])
149149

150150
// Fetch next page
151+
// TODO: this should use the `collection.isLoadingSubset` flag in combination with
152+
// isFetchingRef to track if it is fetching from subset for this. This needs adding
153+
// once https://github.com/TanStack/db/pull/669 is merged
151154
const fetchNextPage = useCallback(() => {
152155
if (!hasNextPage || isFetchingRef.current) return
153156

@@ -161,21 +164,12 @@ export function useLiveInfiniteQuery<TContext extends Context>(
161164
}, [hasNextPage])
162165

163166
return {
167+
...queryResult,
164168
data: flatData,
165169
pages,
166170
pageParams,
167171
fetchNextPage,
168172
hasNextPage,
169173
isFetchingNextPage: isFetchingRef.current,
170-
// Pass through useLiveQuery properties
171-
state: queryResult.state,
172-
collection: queryResult.collection,
173-
status: queryResult.status,
174-
isLoading: queryResult.isLoading,
175-
isReady: queryResult.isReady,
176-
isIdle: queryResult.isIdle,
177-
isError: queryResult.isError,
178-
isCleanedUp: queryResult.isCleanedUp,
179-
isEnabled: queryResult.isEnabled,
180174
}
181175
}

0 commit comments

Comments
 (0)