We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d8c6880 commit 361592bCopy full SHA for 361592b
1 file changed
src/utils.ts
@@ -1,4 +1,8 @@
1
-import { type QueryClient, useQueryClient } from '@tanstack/react-query'
+import {
2
+ type Query,
3
+ type QueryClient,
4
+ useQueryClient,
5
+} from '@tanstack/react-query'
6
7
import type { Middleware, inferQueryKey } from './types'
8
@@ -35,12 +39,15 @@ export const withMiddleware = (
35
39
}
36
40
37
41
42
+const defaultThrowOnError = (_error: unknown, query: Query) =>
43
+ query.state.data === undefined
44
+
38
45
export const suspenseOptions = {
46
enabled: true,
47
suspense: true,
- throwOnError: true,
48
+ throwOnError: defaultThrowOnError,
49
// Compatible with ReactQuery v4
- useErrorBoundary: true,
50
+ useErrorBoundary: defaultThrowOnError,
51
52
53
export const getKey = <TVariables = void>(
0 commit comments