Skip to content

Conversation

daninus14
Copy link

@daninus14 daninus14 commented Oct 21, 2025

the first example was broken, now it works!

🎯 Changes

the first example in the pagination docs was broken, now it works!

βœ… Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr. (doesn't apply)

πŸš€ Release Impact

  • This change is docs (no release).

Summary by CodeRabbit

Release Notes

  • Documentation
    • Updated pagination query guide to ensure queries correctly use the current page parameter, preventing issues with stale values when navigating between pages.

the first example was broken, now it works!
@changeset-bot
Copy link

changeset-bot bot commented Oct 21, 2025

⚠️ No Changeset found

Latest commit: e52a240

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 21, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 21, 2025

Walkthrough

Documentation update to the React paginated queries guide. The queryFn parameter in useQuery is refactored from a direct function reference to a wrapper function that passes the current page parameter, preventing stale closure issues during pagination.

Changes

Cohort / File(s) Change Summary
Documentation: Pagination Query Pattern
docs/framework/react/guides/paginated-queries.md
Updated useQuery example to wrap fetchProjects in an arrow function () => fetchProjects(page), ensuring the query receives the current page value at call time rather than closing over a potentially stale value.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A wrapper function, oh how it shines,
No stale closures in pagination's lines!
Bind page at call time, fresh and bright,
Now queries fetch the data right! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description Check ❓ Inconclusive The pull request description includes all required sections from the template (Changes, Checklist, and Release Impact) and the Checklist and Release Impact sections are properly completed. However, the Changes section is overly vague and generic, stating only that "the first example in the pagination docs was broken, now it works!" without explaining what was specifically broken or how the technical change (wrapping queryFn to bind the page parameter) fixes it. This lack of detail makes it difficult for reviewers to understand the actual problem and solution from the description alone.
βœ… Passed checks (2 passed)
Check name Status Explanation
Title Check βœ… Passed The title "Update query function to include page parameter" is directly related to the main change in the pull request. The raw summary confirms that the change replaces the queryFn with a wrapper function that binds the page parameter at call time, which is exactly what the title describes. The title is concise, clear, and specific enough that a developer scanning the git history would understand the primary change involves updating how the query function handles the page parameter.
Docstring Coverage βœ… Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

πŸ“œ Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 1e77bd4 and e52a240.

πŸ“’ Files selected for processing (1)
  • docs/framework/react/guides/paginated-queries.md (1 hunks)
πŸ”‡ Additional comments (1)
docs/framework/react/guides/paginated-queries.md (1)

13-13: Excellent fix for the pagination example.

The wrapper function pattern queryFn: () => fetchProjects(page) correctly captures the current page value at query execution time, ensuring React Query calls fetchProjects with the proper argument rather than with no parameters. This fix resolves the broken behavior in the initial example and maintains consistency with the more detailed example below.

Also applies to: 48-48


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant