Skip to content

Commit 4ec77ca

Browse files
committed
docs: remove background retry pausing documentation and update query retries guide
1 parent e704a9b commit 4ec77ca

File tree

2 files changed

+25
-133
lines changed

2 files changed

+25
-133
lines changed

docs/framework/react/guides/background-retry-pausing.md

Lines changed: 0 additions & 133 deletions
This file was deleted.

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,28 @@ const result = useQuery({
7878
```
7979

8080
[//]: # 'Example3'
81+
82+
## Background Retry Behavior
83+
84+
When using `refetchInterval` with `refetchIntervalInBackground: true`, retries will pause when the browser tab is inactive. This is because retries respect the same focus-based behavior as regular refetches.
85+
86+
If you need continuous retries in the background, consider disabling retries and implementing a custom refetch strategy:
87+
88+
[//]: # 'Example4'
89+
90+
```tsx
91+
const result = useQuery({
92+
queryKey: ['todos'],
93+
queryFn: fetchTodos,
94+
refetchInterval: (data, query) => {
95+
// Refetch more frequently when in error state
96+
return query.state.status === 'error' ? 5000 : 30000
97+
},
98+
refetchIntervalInBackground: true,
99+
retry: false, // Disable built-in retries
100+
})
101+
```
102+
103+
[//]: # 'Example4'
104+
105+
This approach gives you more control over the retry behavior while maintaining background execution.

0 commit comments

Comments
 (0)