fix: reject ignored infinite-query page callbacks #1806
MergedKyleAMathews(GitHub profile, opens in a new tab)merged 5 commits into
main fromrefs/pull/1806/headmerged by KyleAMathews(GitHub profile, opens in a new tab) - @@ -0,0 +11,21 @@11+not a new InfiniteQueryObserver bridge or remote cursor registry.12+13+[x] Remove the callback from React, Vue, and Svelte config types. Keep generic14+ config wrappers source-compatible; unrelated return types stay unchanged.15+[x] RED first: all three hook guards failed against baseline with the query16+ callback reached before rejection. Logs: `/private/tmp/968-{react,vue,svelte}-red.log`.17+[x] GREEN: reject the removed option before hook resources/query construction.18+ Type tests also assert the callback is not advertised.19+[x] Preserve existing successful hook tests without the ignored callback.20+[x] Expand the actual Query DB/React boundary to 36 cells: server page sizes21+ 1/2/3/5 × UI sizes 1/2/5 × row counts 0/1/8. Each checkpoint compares full22+ visible IDs and hasNextPage to an independent array slice.23+[x] Keep eager transport, prefix retention, invalid capped-provider, page-label,24+ and explicit-refetch ownership controls. The capped provider violates the25+ request protocol; its characterization is not a successful pagination oracle.26+[x] Replace the misleading manual-append pagination example with an on-demand27+ fixed-server-page drain example; explain ordering/filter translation,28+ cancellation, exhaustion, unlimited loads, and opaque-cursor boundaries.29+[x] Fix the React overview to stop recommending the ignored callback.30+[x] Full React: 220 checks (runtime and type cases), Vue: 96, Svelte: 101.31+ Query DB full suite: 195 runtime cases plus its type pass. All GREEN.@@ -0,0 +145,21 @@145+fixture's nextPage is endpoint-authoritative test data used only inside QueryFn.146+The intentionally broken capped-provider probe characterizes missing information;147+it must not become a green oracle accepting this provider as correct.148+149+## Verification handoff150+151+From packages/react-db:152+`pnpm exec vitest run tests/server-pagination-probe.test.tsx --coverage.enabled=false --maxWorkers=2`153+passes all seven probes, no React type errors.154+155+From packages/query-db-collection:156+`pnpm exec vitest run tests/server-pagination-boundary.test.ts --coverage.enabled=false --typecheck.enabled=false --maxWorkers=2`157+checks that explicit refetch removes a manually appended eager row despite158+staleTime Infinity. Runtime passes. The package-wide type pass is blocked by159+unbuilt Electric declarations imported by existing cross-package E2E suites.160+A fixture inference error found by that pass was corrected with an explicit161+page-response type; no production code changed.162+163+Local builds of db-ivm and db completed. No runtime fix, public API migration,164+changeset, commit or PR was made. All probe files and this document are untracked165+for parent review; do not stage parent-owned rfc-next-work-plan.md.
tannerlinsley approved these changes
KyleAMathews(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Advanced
Run ID:
de925f59-18f8-4f94-807f-0d5748d36ff9📥 Commits
Reviewing files that changed from the base of the PR and between 60dc14e5018c882224c3d6b21af1e1f245e15493 and 90bde3f75d9a03aa6d88623b0dc508ba917a5271.
📒 Files selected for processing (1)
notes/rfc-1657-server-pagination.mdIncluded review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review.
📝 Walkthrough
Walkthrough#
useLiveInfiniteQueryno longer acceptsgetNextPageParam. React, Vue, and Svelte now reject it at runtime. Documentation and tests describe on-demand Query Collection pagination throughmeta.loadSubsetOptions.Changes#
Server pagination contract
packages/react-db/src/useLiveInfiniteQuery.ts,packages/vue-db/src/useLiveInfiniteQuery.ts,packages/svelte-db/src/useLiveInfiniteQuery.svelte.ts,packages/*/tests/useLiveInfiniteQuery*getNextPageParam. The hooks reject the option before query construction. Tests cover the runtime and type-level contracts.packages/query-db-collection/tests/server-pagination-fixture.ts,packages/query-db-collection/tests/server-pagination-boundary.test.ts,packages/react-db/tests/server-pagination-probe.test.tsxhasNextPage.docs/collections/query-collection.md,docs/framework/react/overview.md,.changeset/reject-ignored-page-callback.md,notes/rfc-1657-server-pagination.mdmeta.loadSubsetOptions, page-label semantics, fixed-size server-page draining, and the rejected callback. The changeset records minor package releases.Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
✅ Passed checks (4 passed)
Full details: Docstring Coverage
Explanation
Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 11 files. (1 skipped: 1 unsupported.)
✨ 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