docs(query-core): add JSDoc for 'initialPageParam' - #11551
Conversation
|
Important Review skippedToo many files! This PR contains 457 files, which is 157 over the limit of 300. To get a review, reduce the PR to 300 files or fewer by splitting it into smaller PRs or changing its base branch. Usage-priced reviews support at most 300 files. ⚙️ Run configurationConfiguration used: Repository: TanStack/query/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (457)
You can disable this status message by setting the 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. Comment |
|
View your CI Pipeline Execution ↗ for commit 7cb40aa
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview1 package(s) bumped directly, 24 bumped as dependents. 🟩 Patch bumps
|
size-limit report 📦
|
7cb40aa to
7c0dad5
Compare
🎯 Changes
InitialPageParamcarries no JSDoc, soinitialPageParam— a required option for every infinite query — renders with an empty description on seven pages per adapter:initialPageParamTPageParamThis adds a comment for it in
query-core, filling 34 empty description cells across the generated reference.The wording follows
getNextPageParamandgetPreviousPageParam, which sit next to it inInfiniteQueryPageParamsOptionsand are already documented.Why the last sentence is there
The deleted v4 page described this option as "the default page param to use when fetching the first page". That is true but incomplete:
infiniteQueryBehaviorreadsoldPageParams[0] ?? options.initialPageParam, so once the query holds a page, the stored param wins andinitialPageParamis not consulted. Only the first page param is reused that way — subsequent pages are recomputed throughgetNextPageParam— so the comment says "that page's own param" rather than implying every stored param is replayed.Each claim was checked against the implementation:
currentPage === 0 ? (oldPageParams[0] ?? options.initialPageParam) : …queryFnaspageParampageParam: paramin the query function contextgetNextPageParamon refetch,getPreviousPageParamwhen paging backwardInitialPageParamis extended solely by the infinite query option typesNote on the diff size
456 files change, but only 27 of them change content. The other 429 are
Defined in …types.ts#L…links shifting because the comment adds lines totypes.ts.initialPageParamstill renders empty onQueryExecuteOptions, where it is re-declared asinitialPageParam?: neverto reject the option rather than inherit it. There is no value to describe there, so it is left alone.Verification
initialPageParam: 41 → 7 (all remaining ones are theneverre-declaration above)pnpm --filter @tanstack/query-core run test:typespasses on TS 5.6 through 7.0The source change is comments only; no type or runtime behaviour changes.
✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact