From 1f89482e9683fd5472b33b4db3d19cdb0a298738 Mon Sep 17 00:00:00 2001 From: Murali Date: Tue, 10 Feb 2026 11:15:43 -0500 Subject: [PATCH] fix(examples): show "Nothing more to load" in infinite scroll example The loader row was excluded from the virtualizer count when hasNextPage was false, so the end-of-list message never rendered. Always include the extra row and add a stop condition to demonstrate the behavior. Closes #1068 --- examples/react/infinite-scroll/src/main.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/react/infinite-scroll/src/main.tsx b/examples/react/infinite-scroll/src/main.tsx index 508870093..10754ce80 100644 --- a/examples/react/infinite-scroll/src/main.tsx +++ b/examples/react/infinite-scroll/src/main.tsx @@ -37,7 +37,8 @@ function App() { } = useInfiniteQuery({ queryKey: ['projects'], queryFn: (ctx) => fetchServerPage(10, ctx.pageParam), - getNextPageParam: (lastGroup) => lastGroup.nextOffset, + getNextPageParam: (lastGroup) => + lastGroup.nextOffset < 5 ? lastGroup.nextOffset : undefined, initialPageParam: 0, }) @@ -46,7 +47,7 @@ function App() { const parentRef = React.useRef(null) const rowVirtualizer = useVirtualizer({ - count: hasNextPage ? allRows.length + 1 : allRows.length, + count: allRows.length + 1, getScrollElement: () => parentRef.current, estimateSize: () => 100, overscan: 5,