Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

query-retries.md

39 lines799 Bytes

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