From 61138a519e4f21f8b3b032a2f6543c7eddc19016 Mon Sep 17 00:00:00 2001 From: lourq Date: Tue, 13 Jan 2026 16:41:41 +0200 Subject: [PATCH] docs: clarify that failureCount starts at 0 in retry callback Added clarification that failureCount parameter in the retry callback function starts at 0 for the first retry attempt, not 1. Fixes #10017 --- docs/framework/react/guides/query-retries.md | 2 +- docs/framework/react/reference/useQuery.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/framework/react/guides/query-retries.md b/docs/framework/react/guides/query-retries.md index fa1364dfba..08e2fbab26 100644 --- a/docs/framework/react/guides/query-retries.md +++ b/docs/framework/react/guides/query-retries.md @@ -10,7 +10,7 @@ You can configure retries both on a global level and an individual query level. - Setting `retry = false` will disable retries. - Setting `retry = 6` will retry failing requests 6 times before showing the final error thrown by the function. - Setting `retry = true` will infinitely retry failing requests. -- Setting `retry = (failureCount, error) => ...` allows for custom logic based on why the request failed. +- Setting `retry = (failureCount, error) => ...` allows for custom logic based on why the request failed. Note that `failureCount` starts at `0` for the first retry attempt. [//]: # 'Info' diff --git a/docs/framework/react/reference/useQuery.md b/docs/framework/react/reference/useQuery.md index d3b10142a8..c17fe8b79d 100644 --- a/docs/framework/react/reference/useQuery.md +++ b/docs/framework/react/reference/useQuery.md @@ -84,6 +84,7 @@ const { - If `false`, failed queries will not retry by default. - If `true`, failed queries will retry infinitely. - If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. + - If set to a function, it will be called with `failureCount` (starting at `0` for the first retry) and `error` to determine if a retry should be attempted. - defaults to `3` on the client and `0` on the server - `retryOnMount: boolean` - If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`.