File size: 799 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
---
id: query-retries
title: Query Retries
ref: docs/framework/react/guides/query-retries.md
replace: { 'Provider': 'Plugin' }
---
[//]: # 'Example'
```tsx
import { useQuery } from '@tanstack/vue-query'
// Make a specific query retry a certain number of times
const result = useQuery({
queryKey: ['todos', 1],
queryFn: fetchTodoListPage,
retry: 10, // Will retry failed requests 10 times before displaying an error
})
```
[//]: # 'Example'
[//]: # 'Example2'
```ts
import { VueQueryPlugin } from '@tanstack/vue-query'
const vueQueryPluginOptions = {
queryClientConfig: {
defaultOptions: {
queries: {
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 30000),
},
},
},
}
app.use(VueQueryPlugin, vueQueryPluginOptions)
```
[//]: # 'Example2'
|