Skip to content

Commit 4dcb490

Browse files
authored
docs(tests): infinite scroll without click more button (TanStack#3247)
On the first rendering, `hasNextPage` is `undefined`, but converted to `true` by the default value. For intersection observer to trigger correctly without clicking more button, `hasNextPage` needs type casting.
1 parent 6710bc1 commit 4dcb490

File tree

1 file changed

+1
-1
lines changed
  • examples/load-more-infinite-scroll/pages

1 file changed

+1
-1
lines changed

examples/load-more-infinite-scroll/pages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function Example() {
4848
useIntersectionObserver({
4949
target: loadMoreButtonRef,
5050
onIntersect: fetchNextPage,
51-
enabled: hasNextPage,
51+
enabled: !!hasNextPage,
5252
})
5353

5454
return (

0 commit comments

Comments
 (0)