Skip to content

Commit 4e8be3f

Browse files
authored
docs: clarify that failureCount starts at 0 in retry callback (#10031)
Added clarification that failureCount parameter in the retry callback function starts at 0 for the first retry attempt, not 1. Fixes #10017
1 parent bf7f47e commit 4e8be3f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

docs/framework/react/guides/query-retries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ You can configure retries both on a global level and an individual query level.
1010
- Setting `retry = false` will disable retries.
1111
- Setting `retry = 6` will retry failing requests 6 times before showing the final error thrown by the function.
1212
- Setting `retry = true` will infinitely retry failing requests.
13-
- Setting `retry = (failureCount, error) => ...` allows for custom logic based on why the request failed.
13+
- 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.
1414

1515
[//]: # 'Info'
1616

docs/framework/react/reference/useQuery.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const {
8484
- If `false`, failed queries will not retry by default.
8585
- If `true`, failed queries will retry infinitely.
8686
- If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number.
87+
- 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.
8788
- defaults to `3` on the client and `0` on the server
8889
- `retryOnMount: boolean`
8990
- If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`.

0 commit comments

Comments
 (0)