test({react,preact}-query/usePrefetchInfiniteQuery): inline single-use helpers and adopt the 'pageParam' mock convention#11079
Conversation
…e helpers and adopt the 'pageParam' mock convention
|
View your CI Pipeline Execution ↗ for commit da1f81d
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Preact and React ChangesInfinite query test refactor
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
size-limit report 📦
|
🎯 Changes
Inlines the
createFallbackfactory (called only twice) directly at each call site, and rewritesgenerateInfiniteQueryOptions— a stateful closure-based page mock — to use thepageParam-drivenqueryFn/getNextPageParamconvention already used byuseInfiniteQuery.test.tsx, removing the shared helper entirely. Applies to bothreact-queryandpreact-query.The
should not create an endless loop when using inside a suspense boundarytest'sgetNextPageParamalways reports another page available (never returnsundefined), preserving the original's perpetual-hasNextPagesemantics that maketoHaveBeenCalledTimes(3)a meaningful guard against runaway auto-advancing. The other two tests terminate pagination at 3 pages, matching their originals.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit