Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/framework/react/guides/query-retries.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,28 @@ const result = useQuery({
```

[//]: # 'Example3'

## Background Retry Behavior

When using `refetchInterval` with `refetchIntervalInBackground: true`, retries will pause when the browser tab is inactive. This happens because retries respect the same focus behavior as regular refetches.

If you need continuous retries in the background, consider disabling retries and implementing a custom refetch strategy:

[//]: # 'Example4'

```tsx
const result = useQuery({
queryKey: ['todos'],
queryFn: fetchTodos,
refetchInterval: (query) => {
// Refetch more frequently when in error state
return query.state.status === 'error' ? 5000 : 30000
},
refetchIntervalInBackground: true,
retry: false, // Disable built-in retries
})
```

[//]: # 'Example4'

This approach lets you control retry timing manually while keeping refetches active in the background.