Skip to content

Conversation

@lourq
Copy link

@lourq lourq commented Jan 13, 2026

Summary

Added clarification that failureCount parameter in the retry callback function starts at 0 for the first retry attempt, not 1.

Changes

  • docs/framework/react/guides/query-retries.md: Added note about failureCount starting at 0
  • docs/framework/react/reference/useQuery.md: Added explanation for the function variant of retry option

This helps developers understand that on the first retry check, failureCount will be 0, which can be surprising if not documented.

Fixes #10017

Summary by CodeRabbit

  • Documentation
    • Clarified retry functionality documentation to explain that the failureCount parameter starts at 0 for the first retry attempt and is provided to custom retry functions alongside the error for retry decision-making.

✏️ Tip: You can customize this high-level summary in your review settings.

Added clarification that failureCount parameter in the retry callback
function starts at 0 for the first retry attempt, not 1.

Fixes TanStack#10017
@changeset-bot
Copy link

changeset-bot bot commented Jan 13, 2026

⚠️ No Changeset found

Latest commit: 61138a5

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 Jan 13, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 13, 2026

📝 Walkthrough

Walkthrough

Two documentation files updated to clarify that the failureCount parameter in retry callback functions starts at 0 on the first retry attempt, not 1. Changes address user confusion about the initial value of this parameter.

Changes

Cohort / File(s) Summary
Documentation clarifications
docs/framework/react/guides/query-retries.md, docs/framework/react/reference/useQuery.md
Added explicit notes explaining that failureCount begins at 0 in the first retry callback invocation, clarifying non-obvious parameter behavior

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

documentation

Poem

🐰 A curious hop through the retry chain,
Where failureCount starts fresh, clear as rain,
Zero, not one, the docs now declare,
So no more confusion in the retry snare!

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The pull request description provides a clear summary of changes and links to the related issue, but does not follow the repository's description template structure. Follow the repository's description template by adding a checklist section and specifying the release impact (this appears to be docs-only).
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately describes the main change: clarifying that failureCount starts at 0 in the retry callback function.
Linked Issues check ✅ Passed The pull request successfully addresses the objective from issue #10017 by adding documentation clarifying that failureCount starts at 0 in the retry callback.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objective of clarifying failureCount behavior in retry callbacks; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44c3cb9 and 61138a5.

📒 Files selected for processing (2)
  • docs/framework/react/guides/query-retries.md
  • docs/framework/react/reference/useQuery.md
🧰 Additional context used
🪛 LanguageTool
docs/framework/react/guides/query-retries.md

[style] ~13-~13: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ll infinitely retry failing requests. - Setting retry = (failureCount, error) => ... ...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

docs/framework/react/reference/useQuery.md

[style] ~87-~87: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...iled query count meets that number. - If set to a function, it will be called wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🔇 Additional comments (2)
docs/framework/react/guides/query-retries.md (1)

13-13: LGTM! Clear documentation of failureCount behavior.

The added clarification that failureCount starts at 0 for the first retry attempt directly addresses the confusion reported in issue #10017 and will help developers understand the expected behavior when implementing custom retry logic.

docs/framework/react/reference/useQuery.md (1)

87-87: LGTM! Consistent and helpful clarification.

The documentation accurately clarifies that failureCount starts at 0 for the first retry, which is consistent with the change in the guides file and addresses the documentation gap identified in issue #10017.


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.

failureCount in the retry callback starts at zero

1 participant