🎯 Changes#
useLiveInfiniteQuery baked .limit(pageSize + 1).offset(0) into the initial query builder. This capped results even after setWindow() tried to expand the window for subsequent pages, making pagination beyond page 1 return no additional data.
The fix removes the hardcoded limit/offset from the initial query and lets setWindow() (called in the useEffect below) be the sole authority on the query window.
✅ Checklist#
🚀 Release Impact#
Summary by CodeRabbit#
Bug Fixes#
- Fixed infinite query pagination to properly manage dynamic pagination windows across multiple pages without hardcoded initial limits, ensuring correct data retrieval for all pages.

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
8ad95452-7b34-4933-ade7-48b0a9168979📥 Commits
Reviewing files that changed from the base of the PR and between be656be5c5fa65cc1c2bf76bc0b60be3d9d2a577 and 4954cc336130683c9c5ecce0602409dcfc272de5.
📒 Files selected for processing (3)
.changeset/fix-infinite-query-limit-offset.mdpackages/react-db/src/useLiveInfiniteQuery.tspackages/react-db/tests/useLiveInfiniteQuery.test.tsx📝 Walkthrough
Walkthrough#
This PR removes hardcoded
limit/offsetconstraints fromuseLiveInfiniteQuery's initial query setup. Instead of baking apageSize + 1peek-ahead window into the query, the hook now delegates all pagination window control toutils.setWindow(). The test suite is comprehensively updated to validate observable outcomes (hasNextPage, data length, page counts) rather than internal request shapes, and a new regression test ensures correct multi-page behavior with the query-function pattern.Changes#
useLiveInfiniteQuery Window Control Fix
.changeset/fix-infinite-query-limit-offset.md,packages/react-db/src/useLiveInfiniteQuery.ts.limit(pageSize + 1)/.offset(0)window, passing collection or query function directly touseLiveQuerywithout peek-ahead constraints, and documents the patch release.packages/react-db/tests/useLiveInfiniteQuery.test.tsxhasNextPage,datalength) instead of internal call counts and transition flags; mockloadSubsetis rewritten to handle cursor pagination with filtering and sorting; a regression test validates correct item IDs andhasNextPageacross pages 2–3 in query-function pattern usage.Sequence Diagram#
Estimated code review effort#
🎯 3 (Moderate) | ⏱️ ~22 minutes
Poem#
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share