@tanstack/react-query 4.24.10 → 5.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/HydrationBoundary.d.ts +9 -0
- package/build/lib/{Hydrate.esm.js → HydrationBoundary.esm.js} +14 -17
- package/build/lib/HydrationBoundary.esm.js.map +1 -0
- package/build/lib/{Hydrate.js → HydrationBoundary.js} +17 -24
- package/build/lib/HydrationBoundary.js.map +1 -0
- package/build/lib/{Hydrate.mjs → HydrationBoundary.mjs} +14 -17
- package/build/lib/HydrationBoundary.mjs.map +1 -0
- package/build/lib/QueryClientProvider.d.ts +4 -19
- package/build/lib/QueryClientProvider.esm.js +11 -46
- package/build/lib/QueryClientProvider.esm.js.map +1 -1
- package/build/lib/QueryClientProvider.js +14 -52
- package/build/lib/QueryClientProvider.js.map +1 -1
- package/build/lib/QueryClientProvider.mjs +11 -46
- package/build/lib/QueryClientProvider.mjs.map +1 -1
- package/build/lib/QueryErrorResetBoundary.esm.js +7 -2
- package/build/lib/QueryErrorResetBoundary.esm.js.map +1 -1
- package/build/lib/QueryErrorResetBoundary.js +10 -8
- package/build/lib/QueryErrorResetBoundary.js.map +1 -1
- package/build/lib/QueryErrorResetBoundary.mjs +7 -2
- package/build/lib/QueryErrorResetBoundary.mjs.map +1 -1
- package/build/lib/__tests__/useQuery.types.test.d.ts +1 -2
- package/build/lib/__tests__/utils.d.ts +7 -10
- package/build/lib/errorBoundaryUtils.d.ts +3 -3
- package/build/lib/errorBoundaryUtils.esm.js +3 -3
- package/build/lib/errorBoundaryUtils.esm.js.map +1 -1
- package/build/lib/errorBoundaryUtils.js +6 -9
- package/build/lib/errorBoundaryUtils.js.map +1 -1
- package/build/lib/errorBoundaryUtils.mjs +3 -3
- package/build/lib/errorBoundaryUtils.mjs.map +1 -1
- package/build/lib/index.d.ts +4 -5
- package/build/lib/index.esm.js +3 -4
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +6 -9
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +3 -4
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/isRestoring.esm.js.map +1 -1
- package/build/lib/isRestoring.js +3 -6
- package/build/lib/isRestoring.js.map +1 -1
- package/build/lib/isRestoring.mjs.map +1 -1
- package/build/lib/suspense.esm.js +5 -5
- package/build/lib/suspense.esm.js.map +1 -1
- package/build/lib/suspense.js +5 -7
- package/build/lib/suspense.js.map +1 -1
- package/build/lib/suspense.mjs +5 -5
- package/build/lib/suspense.mjs.map +1 -1
- package/build/lib/types.d.ts +14 -22
- package/build/lib/useBaseQuery.d.ts +2 -2
- package/build/lib/useBaseQuery.esm.js +15 -18
- package/build/lib/useBaseQuery.esm.js.map +1 -1
- package/build/lib/useBaseQuery.js +18 -24
- package/build/lib/useBaseQuery.js.map +1 -1
- package/build/lib/useBaseQuery.mjs +15 -18
- package/build/lib/useBaseQuery.mjs.map +1 -1
- package/build/lib/useInfiniteQuery.d.ts +2 -4
- package/build/lib/useInfiniteQuery.esm.js +4 -4
- package/build/lib/useInfiniteQuery.esm.js.map +1 -1
- package/build/lib/useInfiniteQuery.js +3 -5
- package/build/lib/useInfiniteQuery.js.map +1 -1
- package/build/lib/useInfiniteQuery.mjs +4 -4
- package/build/lib/useInfiniteQuery.mjs.map +1 -1
- package/build/lib/useIsFetching.d.ts +2 -7
- package/build/lib/useIsFetching.esm.js +5 -9
- package/build/lib/useIsFetching.esm.js.map +1 -1
- package/build/lib/useIsFetching.js +7 -14
- package/build/lib/useIsFetching.js.map +1 -1
- package/build/lib/useIsFetching.mjs +5 -9
- package/build/lib/useIsFetching.mjs.map +1 -1
- package/build/lib/useMutation.d.ts +2 -5
- package/build/lib/useMutation.esm.js +12 -14
- package/build/lib/useMutation.esm.js.map +1 -1
- package/build/lib/useMutation.js +14 -19
- package/build/lib/useMutation.js.map +1 -1
- package/build/lib/useMutation.mjs +12 -14
- package/build/lib/useMutation.mjs.map +1 -1
- package/build/lib/useMutationState.d.ts +8 -0
- package/build/lib/useMutationState.esm.js +37 -0
- package/build/lib/useMutationState.esm.js.map +1 -0
- package/build/lib/useMutationState.js +59 -0
- package/build/lib/useMutationState.js.map +1 -0
- package/build/lib/useMutationState.mjs +37 -0
- package/build/lib/useMutationState.mjs.map +1 -0
- package/build/lib/useQueries.d.ts +9 -7
- package/build/lib/useQueries.esm.js +16 -27
- package/build/lib/useQueries.esm.js.map +1 -1
- package/build/lib/useQueries.js +19 -33
- package/build/lib/useQueries.js.map +1 -1
- package/build/lib/useQueries.mjs +16 -27
- package/build/lib/useQueries.mjs.map +1 -1
- package/build/lib/useQuery.d.ts +9 -21
- package/build/lib/useQuery.esm.js +5 -4
- package/build/lib/useQuery.esm.js.map +1 -1
- package/build/lib/useQuery.js +4 -5
- package/build/lib/useQuery.js.map +1 -1
- package/build/lib/useQuery.mjs +5 -4
- package/build/lib/useQuery.mjs.map +1 -1
- package/build/lib/utils.d.ts +1 -1
- package/build/lib/utils.esm.js +5 -6
- package/build/lib/utils.esm.js.map +1 -1
- package/build/lib/utils.js +5 -8
- package/build/lib/utils.js.map +1 -1
- package/build/lib/utils.mjs +5 -6
- package/build/lib/utils.mjs.map +1 -1
- package/build/umd/index.development.js +1003 -1827
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +6 -18
- package/src/{Hydrate.tsx → HydrationBoundary.tsx} +17 -18
- package/src/QueryClientProvider.tsx +11 -65
- package/src/__tests__/{Hydrate.test.tsx → HydrationBoundary.test.tsx} +89 -77
- package/src/__tests__/QueryClientProvider.test.tsx +33 -147
- package/src/__tests__/QueryResetErrorBoundary.test.tsx +118 -85
- package/src/__tests__/ssr-hydration.test.tsx +27 -33
- package/src/__tests__/ssr.test.tsx +23 -9
- package/src/__tests__/suspense.test.tsx +194 -171
- package/src/__tests__/useInfiniteQuery.test.tsx +249 -494
- package/src/__tests__/useInfiniteQuery.type.test.tsx +131 -0
- package/src/__tests__/useIsFetching.test.tsx +65 -108
- package/src/__tests__/useMutation.test.tsx +200 -268
- package/src/__tests__/useMutationState.test.tsx +284 -0
- package/src/__tests__/useQueries.test.tsx +43 -347
- package/src/__tests__/useQuery.test.tsx +890 -686
- package/src/__tests__/useQuery.types.test.tsx +23 -24
- package/src/__tests__/utils.tsx +14 -23
- package/src/errorBoundaryUtils.ts +5 -10
- package/src/index.ts +4 -7
- package/src/types.ts +33 -38
- package/src/useBaseQuery.ts +7 -7
- package/src/useInfiniteQuery.ts +12 -77
- package/src/useIsFetching.ts +8 -20
- package/src/useMutation.ts +8 -66
- package/src/useMutationState.ts +81 -0
- package/src/useQueries.ts +29 -21
- package/src/useQuery.ts +27 -104
- package/src/utils.ts +5 -5
- package/build/lib/Hydrate.d.ts +0 -10
- package/build/lib/Hydrate.esm.js.map +0 -1
- package/build/lib/Hydrate.js.map +0 -1
- package/build/lib/Hydrate.mjs.map +0 -1
- package/build/lib/reactBatchedUpdates.d.ts +0 -2
- package/build/lib/reactBatchedUpdates.esm.js +0 -6
- package/build/lib/reactBatchedUpdates.esm.js.map +0 -1
- package/build/lib/reactBatchedUpdates.js +0 -30
- package/build/lib/reactBatchedUpdates.js.map +0 -1
- package/build/lib/reactBatchedUpdates.mjs +0 -6
- package/build/lib/reactBatchedUpdates.mjs.map +0 -1
- package/build/lib/reactBatchedUpdates.native.d.ts +0 -2
- package/build/lib/reactBatchedUpdates.native.esm.js +0 -2
- package/build/lib/reactBatchedUpdates.native.esm.js.map +0 -1
- package/build/lib/reactBatchedUpdates.native.js +0 -13
- package/build/lib/reactBatchedUpdates.native.js.map +0 -1
- package/build/lib/reactBatchedUpdates.native.mjs +0 -2
- package/build/lib/reactBatchedUpdates.native.mjs.map +0 -1
- package/build/lib/setBatchUpdatesFn.esm.js +0 -5
- package/build/lib/setBatchUpdatesFn.esm.js.map +0 -1
- package/build/lib/setBatchUpdatesFn.js +0 -7
- package/build/lib/setBatchUpdatesFn.js.map +0 -1
- package/build/lib/setBatchUpdatesFn.mjs +0 -5
- package/build/lib/setBatchUpdatesFn.mjs.map +0 -1
- package/build/lib/useIsMutating.d.ts +0 -7
- package/build/lib/useIsMutating.esm.js +0 -16
- package/build/lib/useIsMutating.esm.js.map +0 -1
- package/build/lib/useIsMutating.js +0 -40
- package/build/lib/useIsMutating.js.map +0 -1
- package/build/lib/useIsMutating.mjs +0 -16
- package/build/lib/useIsMutating.mjs.map +0 -1
- package/build/lib/useSyncExternalStore.d.ts +0 -2
- package/build/lib/useSyncExternalStore.esm.js +0 -7
- package/build/lib/useSyncExternalStore.esm.js.map +0 -1
- package/build/lib/useSyncExternalStore.js +0 -11
- package/build/lib/useSyncExternalStore.js.map +0 -1
- package/build/lib/useSyncExternalStore.mjs +0 -7
- package/build/lib/useSyncExternalStore.mjs.map +0 -1
- package/build/lib/useSyncExternalStore.native.d.ts +0 -2
- package/build/lib/useSyncExternalStore.native.esm.js +0 -2
- package/build/lib/useSyncExternalStore.native.esm.js.map +0 -1
- package/build/lib/useSyncExternalStore.native.js +0 -13
- package/build/lib/useSyncExternalStore.native.js.map +0 -1
- package/build/lib/useSyncExternalStore.native.mjs +0 -2
- package/build/lib/useSyncExternalStore.native.mjs.map +0 -1
- package/codemods/v4/key-transformation.js +0 -138
- package/codemods/v4/replace-import-specifier.js +0 -25
- package/codemods/v4/utils/index.js +0 -166
- package/codemods/v4/utils/replacers/key-replacer.js +0 -160
- package/codemods/v4/utils/transformers/query-cache-transformer.js +0 -115
- package/codemods/v4/utils/transformers/query-client-transformer.js +0 -49
- package/codemods/v4/utils/transformers/use-query-like-transformer.js +0 -32
- package/codemods/v4/utils/unprocessable-key-error.js +0 -8
- package/src/__tests__/useIsMutating.test.tsx +0 -259
- package/src/reactBatchedUpdates.native.ts +0 -4
- package/src/reactBatchedUpdates.ts +0 -2
- package/src/setBatchUpdatesFn.ts +0 -4
- package/src/useIsMutating.ts +0 -39
- package/src/useSyncExternalStore.native.ts +0 -5
- package/src/useSyncExternalStore.ts +0 -4
- /package/build/lib/__tests__/{Hydrate.test.d.ts → HydrationBoundary.test.d.ts} +0 -0
- /package/build/lib/__tests__/{useIsMutating.test.d.ts → useInfiniteQuery.type.test.d.ts} +0 -0
- /package/build/lib/{setBatchUpdatesFn.d.ts → __tests__/useMutationState.test.d.ts} +0 -0
package/src/useMutation.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import type { MutationFunction, MutationKey } from '@tanstack/query-core'
|
|
5
|
-
import {
|
|
6
|
-
notifyManager,
|
|
7
|
-
parseMutationArgs,
|
|
8
|
-
MutationObserver,
|
|
9
|
-
} from '@tanstack/query-core'
|
|
2
|
+
import type { QueryClient, RegisteredError } from '@tanstack/query-core'
|
|
3
|
+
import { notifyManager, MutationObserver } from '@tanstack/query-core'
|
|
10
4
|
import { useQueryClient } from './QueryClientProvider'
|
|
11
5
|
import type {
|
|
12
6
|
UseMutateFunction,
|
|
@@ -19,71 +13,19 @@ import { shouldThrowError } from './utils'
|
|
|
19
13
|
|
|
20
14
|
export function useMutation<
|
|
21
15
|
TData = unknown,
|
|
22
|
-
TError =
|
|
16
|
+
TError = RegisteredError,
|
|
23
17
|
TVariables = void,
|
|
24
18
|
TContext = unknown,
|
|
25
19
|
>(
|
|
26
20
|
options: UseMutationOptions<TData, TError, TVariables, TContext>,
|
|
27
|
-
|
|
28
|
-
export function useMutation<
|
|
29
|
-
TData = unknown,
|
|
30
|
-
TError = unknown,
|
|
31
|
-
TVariables = void,
|
|
32
|
-
TContext = unknown,
|
|
33
|
-
>(
|
|
34
|
-
mutationFn: MutationFunction<TData, TVariables>,
|
|
35
|
-
options?: Omit<
|
|
36
|
-
UseMutationOptions<TData, TError, TVariables, TContext>,
|
|
37
|
-
'mutationFn'
|
|
38
|
-
>,
|
|
39
|
-
): UseMutationResult<TData, TError, TVariables, TContext>
|
|
40
|
-
export function useMutation<
|
|
41
|
-
TData = unknown,
|
|
42
|
-
TError = unknown,
|
|
43
|
-
TVariables = void,
|
|
44
|
-
TContext = unknown,
|
|
45
|
-
>(
|
|
46
|
-
mutationKey: MutationKey,
|
|
47
|
-
options?: Omit<
|
|
48
|
-
UseMutationOptions<TData, TError, TVariables, TContext>,
|
|
49
|
-
'mutationKey'
|
|
50
|
-
>,
|
|
51
|
-
): UseMutationResult<TData, TError, TVariables, TContext>
|
|
52
|
-
export function useMutation<
|
|
53
|
-
TData = unknown,
|
|
54
|
-
TError = unknown,
|
|
55
|
-
TVariables = void,
|
|
56
|
-
TContext = unknown,
|
|
57
|
-
>(
|
|
58
|
-
mutationKey: MutationKey,
|
|
59
|
-
mutationFn?: MutationFunction<TData, TVariables>,
|
|
60
|
-
options?: Omit<
|
|
61
|
-
UseMutationOptions<TData, TError, TVariables, TContext>,
|
|
62
|
-
'mutationKey' | 'mutationFn'
|
|
63
|
-
>,
|
|
64
|
-
): UseMutationResult<TData, TError, TVariables, TContext>
|
|
65
|
-
export function useMutation<
|
|
66
|
-
TData = unknown,
|
|
67
|
-
TError = unknown,
|
|
68
|
-
TVariables = void,
|
|
69
|
-
TContext = unknown,
|
|
70
|
-
>(
|
|
71
|
-
arg1:
|
|
72
|
-
| MutationKey
|
|
73
|
-
| MutationFunction<TData, TVariables>
|
|
74
|
-
| UseMutationOptions<TData, TError, TVariables, TContext>,
|
|
75
|
-
arg2?:
|
|
76
|
-
| MutationFunction<TData, TVariables>
|
|
77
|
-
| UseMutationOptions<TData, TError, TVariables, TContext>,
|
|
78
|
-
arg3?: UseMutationOptions<TData, TError, TVariables, TContext>,
|
|
21
|
+
queryClient?: QueryClient,
|
|
79
22
|
): UseMutationResult<TData, TError, TVariables, TContext> {
|
|
80
|
-
const
|
|
81
|
-
const queryClient = useQueryClient({ context: options.context })
|
|
23
|
+
const client = useQueryClient(queryClient)
|
|
82
24
|
|
|
83
25
|
const [observer] = React.useState(
|
|
84
26
|
() =>
|
|
85
27
|
new MutationObserver<TData, TError, TVariables, TContext>(
|
|
86
|
-
|
|
28
|
+
client,
|
|
87
29
|
options,
|
|
88
30
|
),
|
|
89
31
|
)
|
|
@@ -92,7 +34,7 @@ export function useMutation<
|
|
|
92
34
|
observer.setOptions(options)
|
|
93
35
|
}, [observer, options])
|
|
94
36
|
|
|
95
|
-
const result = useSyncExternalStore(
|
|
37
|
+
const result = React.useSyncExternalStore(
|
|
96
38
|
React.useCallback(
|
|
97
39
|
(onStoreChange) =>
|
|
98
40
|
observer.subscribe(notifyManager.batchCalls(onStoreChange)),
|
|
@@ -113,7 +55,7 @@ export function useMutation<
|
|
|
113
55
|
|
|
114
56
|
if (
|
|
115
57
|
result.error &&
|
|
116
|
-
shouldThrowError(observer.options.
|
|
58
|
+
shouldThrowError(observer.options.throwErrors, [result.error])
|
|
117
59
|
) {
|
|
118
60
|
throw result.error
|
|
119
61
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
MutationFilters,
|
|
5
|
+
QueryClient,
|
|
6
|
+
Mutation,
|
|
7
|
+
MutationCache,
|
|
8
|
+
RegisteredError,
|
|
9
|
+
} from '@tanstack/query-core'
|
|
10
|
+
import { notifyManager, replaceEqualDeep } from '@tanstack/query-core'
|
|
11
|
+
import { useQueryClient } from './QueryClientProvider'
|
|
12
|
+
import type { MutationState } from '@tanstack/query-core/build/lib/mutation'
|
|
13
|
+
|
|
14
|
+
export function useIsMutating(
|
|
15
|
+
filters?: MutationFilters,
|
|
16
|
+
queryClient?: QueryClient,
|
|
17
|
+
): number {
|
|
18
|
+
const client = useQueryClient(queryClient)
|
|
19
|
+
return useMutationState(
|
|
20
|
+
{ filters: { ...filters, status: 'pending' } },
|
|
21
|
+
client,
|
|
22
|
+
).length
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type MutationStateOptions<TResult> = {
|
|
26
|
+
filters?: MutationFilters
|
|
27
|
+
select?: (
|
|
28
|
+
mutation: Mutation<unknown, RegisteredError, unknown, unknown>,
|
|
29
|
+
) => TResult
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getResult<TResult = MutationState>(
|
|
33
|
+
mutationCache: MutationCache,
|
|
34
|
+
options: MutationStateOptions<TResult>,
|
|
35
|
+
): Array<TResult> {
|
|
36
|
+
return mutationCache
|
|
37
|
+
.findAll(options.filters)
|
|
38
|
+
.map(
|
|
39
|
+
(mutation): TResult =>
|
|
40
|
+
(options.select
|
|
41
|
+
? options.select(
|
|
42
|
+
mutation as Mutation<unknown, RegisteredError, unknown, unknown>,
|
|
43
|
+
)
|
|
44
|
+
: mutation.state) as TResult,
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function useMutationState<TResult = unknown>(
|
|
49
|
+
options: MutationStateOptions<TResult> = {},
|
|
50
|
+
queryClient?: QueryClient,
|
|
51
|
+
): Array<TResult> {
|
|
52
|
+
const mutationCache = useQueryClient(queryClient).getMutationCache()
|
|
53
|
+
const optionsRef = React.useRef(options)
|
|
54
|
+
const result = React.useRef<Array<TResult>>()
|
|
55
|
+
if (!result.current) {
|
|
56
|
+
result.current = getResult(mutationCache, options)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
React.useEffect(() => {
|
|
60
|
+
optionsRef.current = options
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
return React.useSyncExternalStore(
|
|
64
|
+
React.useCallback(
|
|
65
|
+
(onStoreChange) =>
|
|
66
|
+
mutationCache.subscribe(() => {
|
|
67
|
+
const nextResult = replaceEqualDeep(
|
|
68
|
+
result.current,
|
|
69
|
+
getResult(mutationCache, optionsRef.current),
|
|
70
|
+
)
|
|
71
|
+
if (result.current !== nextResult) {
|
|
72
|
+
result.current = nextResult
|
|
73
|
+
notifyManager.schedule(onStoreChange)
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
[mutationCache],
|
|
77
|
+
),
|
|
78
|
+
() => result.current,
|
|
79
|
+
() => result.current,
|
|
80
|
+
)!
|
|
81
|
+
}
|
package/src/useQueries.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import { useSyncExternalStore } from './useSyncExternalStore'
|
|
3
2
|
|
|
4
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
QueryKey,
|
|
5
|
+
QueryFunction,
|
|
6
|
+
QueriesPlaceholderDataFunction,
|
|
7
|
+
QueryClient,
|
|
8
|
+
RegisteredError,
|
|
9
|
+
} from '@tanstack/query-core'
|
|
5
10
|
import { notifyManager, QueriesObserver } from '@tanstack/query-core'
|
|
6
11
|
import { useQueryClient } from './QueryClientProvider'
|
|
7
12
|
import type { UseQueryOptions, UseQueryResult } from './types'
|
|
@@ -20,13 +25,18 @@ import {
|
|
|
20
25
|
} from './suspense'
|
|
21
26
|
|
|
22
27
|
// This defines the `UseQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`.
|
|
23
|
-
//
|
|
28
|
+
// `placeholderData` function does not have a parameter
|
|
24
29
|
type UseQueryOptionsForUseQueries<
|
|
25
30
|
TQueryFnData = unknown,
|
|
26
|
-
TError =
|
|
31
|
+
TError = RegisteredError,
|
|
27
32
|
TData = TQueryFnData,
|
|
28
33
|
TQueryKey extends QueryKey = QueryKey,
|
|
29
|
-
> = Omit<
|
|
34
|
+
> = Omit<
|
|
35
|
+
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
36
|
+
'placeholderData'
|
|
37
|
+
> & {
|
|
38
|
+
placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>
|
|
39
|
+
}
|
|
30
40
|
|
|
31
41
|
// Avoid TS depth-limit error in case of large array literal
|
|
32
42
|
type MAXIMUM_DEPTH = 20
|
|
@@ -55,14 +65,9 @@ type GetOptions<T> =
|
|
|
55
65
|
queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey>
|
|
56
66
|
select: (data: any) => infer TData
|
|
57
67
|
}
|
|
58
|
-
? UseQueryOptionsForUseQueries<TQueryFnData,
|
|
68
|
+
? UseQueryOptionsForUseQueries<TQueryFnData, Error, TData, TQueryKey>
|
|
59
69
|
: T extends { queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> }
|
|
60
|
-
? UseQueryOptionsForUseQueries<
|
|
61
|
-
TQueryFnData,
|
|
62
|
-
unknown,
|
|
63
|
-
TQueryFnData,
|
|
64
|
-
TQueryKey
|
|
65
|
-
>
|
|
70
|
+
? UseQueryOptionsForUseQueries<TQueryFnData, Error, TQueryFnData, TQueryKey>
|
|
66
71
|
: // Fallback
|
|
67
72
|
UseQueryOptionsForUseQueries
|
|
68
73
|
|
|
@@ -143,24 +148,27 @@ export type QueriesResults<
|
|
|
143
148
|
any
|
|
144
149
|
>[]
|
|
145
150
|
? // Dynamic-size (homogenous) UseQueryOptions array: map directly to array of results
|
|
146
|
-
UseQueryResult<
|
|
151
|
+
UseQueryResult<
|
|
152
|
+
unknown extends TData ? TQueryFnData : TData,
|
|
153
|
+
unknown extends TError ? RegisteredError : TError
|
|
154
|
+
>[]
|
|
147
155
|
: // Fallback
|
|
148
156
|
UseQueryResult[]
|
|
149
157
|
|
|
150
158
|
export function useQueries<T extends any[]>({
|
|
151
159
|
queries,
|
|
152
|
-
|
|
160
|
+
queryClient,
|
|
153
161
|
}: {
|
|
154
162
|
queries: readonly [...QueriesOptions<T>]
|
|
155
|
-
|
|
163
|
+
queryClient?: QueryClient
|
|
156
164
|
}): QueriesResults<T> {
|
|
157
|
-
const
|
|
165
|
+
const client = useQueryClient(queryClient)
|
|
158
166
|
const isRestoring = useIsRestoring()
|
|
159
167
|
|
|
160
168
|
const defaultedQueries = React.useMemo(
|
|
161
169
|
() =>
|
|
162
170
|
queries.map((options) => {
|
|
163
|
-
const defaultedOptions =
|
|
171
|
+
const defaultedOptions = client.defaultQueryOptions(options)
|
|
164
172
|
|
|
165
173
|
// Make sure the results are already in fetching state before subscribing or updating options
|
|
166
174
|
defaultedOptions._optimisticResults = isRestoring
|
|
@@ -169,16 +177,16 @@ export function useQueries<T extends any[]>({
|
|
|
169
177
|
|
|
170
178
|
return defaultedOptions
|
|
171
179
|
}),
|
|
172
|
-
[queries,
|
|
180
|
+
[queries, client, isRestoring],
|
|
173
181
|
)
|
|
174
182
|
|
|
175
183
|
const [observer] = React.useState(
|
|
176
|
-
() => new QueriesObserver(
|
|
184
|
+
() => new QueriesObserver(client, defaultedQueries),
|
|
177
185
|
)
|
|
178
186
|
|
|
179
187
|
const optimisticResult = observer.getOptimisticResult(defaultedQueries)
|
|
180
188
|
|
|
181
|
-
useSyncExternalStore(
|
|
189
|
+
React.useSyncExternalStore(
|
|
182
190
|
React.useCallback(
|
|
183
191
|
(onStoreChange) =>
|
|
184
192
|
isRestoring
|
|
@@ -234,7 +242,7 @@ export function useQueries<T extends any[]>({
|
|
|
234
242
|
getHasError({
|
|
235
243
|
result,
|
|
236
244
|
errorResetBoundary,
|
|
237
|
-
|
|
245
|
+
throwErrors: defaultedQueries[index]?.throwErrors ?? false,
|
|
238
246
|
query: observer.getQueries()[index]!,
|
|
239
247
|
}),
|
|
240
248
|
)
|
package/src/useQuery.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
QueryClient,
|
|
3
|
+
QueryKey,
|
|
4
|
+
RegisteredError,
|
|
5
|
+
} from '@tanstack/query-core'
|
|
6
|
+
import { QueryObserver } from '@tanstack/query-core'
|
|
3
7
|
import type {
|
|
4
8
|
DefinedUseQueryResult,
|
|
5
9
|
UseQueryOptions,
|
|
@@ -8,133 +12,52 @@ import type {
|
|
|
8
12
|
import { useBaseQuery } from './useBaseQuery'
|
|
9
13
|
|
|
10
14
|
// HOOK
|
|
11
|
-
|
|
12
|
-
export function useQuery<
|
|
13
|
-
TQueryFnData = unknown,
|
|
14
|
-
TError = unknown,
|
|
15
|
-
TData = TQueryFnData,
|
|
16
|
-
TQueryKey extends QueryKey = QueryKey,
|
|
17
|
-
>(
|
|
18
|
-
options: Omit<
|
|
19
|
-
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
20
|
-
'initialData'
|
|
21
|
-
> & { initialData?: () => undefined },
|
|
22
|
-
): UseQueryResult<TData, TError>
|
|
23
|
-
|
|
24
|
-
export function useQuery<
|
|
25
|
-
TQueryFnData = unknown,
|
|
26
|
-
TError = unknown,
|
|
27
|
-
TData = TQueryFnData,
|
|
28
|
-
TQueryKey extends QueryKey = QueryKey,
|
|
29
|
-
>(
|
|
30
|
-
options: Omit<
|
|
31
|
-
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
32
|
-
'initialData'
|
|
33
|
-
> & { initialData: TQueryFnData | (() => TQueryFnData) },
|
|
34
|
-
): DefinedUseQueryResult<TData, TError>
|
|
35
|
-
|
|
36
|
-
export function useQuery<
|
|
37
|
-
TQueryFnData = unknown,
|
|
38
|
-
TError = unknown,
|
|
39
|
-
TData = TQueryFnData,
|
|
40
|
-
TQueryKey extends QueryKey = QueryKey,
|
|
41
|
-
>(
|
|
42
|
-
options: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
43
|
-
): UseQueryResult<TData, TError>
|
|
44
|
-
|
|
45
|
-
export function useQuery<
|
|
15
|
+
type UndefinedInitialDataOptions<
|
|
46
16
|
TQueryFnData = unknown,
|
|
47
|
-
TError =
|
|
17
|
+
TError = RegisteredError,
|
|
48
18
|
TData = TQueryFnData,
|
|
49
19
|
TQueryKey extends QueryKey = QueryKey,
|
|
50
|
-
>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
54
|
-
'queryKey' | 'initialData'
|
|
55
|
-
> & { initialData?: () => undefined },
|
|
56
|
-
): UseQueryResult<TData, TError>
|
|
20
|
+
> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
21
|
+
initialData?: undefined
|
|
22
|
+
}
|
|
57
23
|
|
|
58
|
-
|
|
24
|
+
type DefinedInitialDataOptions<
|
|
59
25
|
TQueryFnData = unknown,
|
|
60
|
-
TError =
|
|
26
|
+
TError = RegisteredError,
|
|
61
27
|
TData = TQueryFnData,
|
|
62
28
|
TQueryKey extends QueryKey = QueryKey,
|
|
63
|
-
>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
67
|
-
'queryKey' | 'initialData'
|
|
68
|
-
> & { initialData: TQueryFnData | (() => TQueryFnData) },
|
|
69
|
-
): DefinedUseQueryResult<TData, TError>
|
|
70
|
-
|
|
71
|
-
export function useQuery<
|
|
72
|
-
TQueryFnData = unknown,
|
|
73
|
-
TError = unknown,
|
|
74
|
-
TData = TQueryFnData,
|
|
75
|
-
TQueryKey extends QueryKey = QueryKey,
|
|
76
|
-
>(
|
|
77
|
-
queryKey: TQueryKey,
|
|
78
|
-
options?: Omit<
|
|
79
|
-
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
80
|
-
'queryKey'
|
|
81
|
-
>,
|
|
82
|
-
): UseQueryResult<TData, TError>
|
|
29
|
+
> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
30
|
+
initialData: TQueryFnData | (() => TQueryFnData)
|
|
31
|
+
}
|
|
83
32
|
|
|
84
33
|
export function useQuery<
|
|
85
34
|
TQueryFnData = unknown,
|
|
86
|
-
TError =
|
|
35
|
+
TError = RegisteredError,
|
|
87
36
|
TData = TQueryFnData,
|
|
88
37
|
TQueryKey extends QueryKey = QueryKey,
|
|
89
38
|
>(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
options?: Omit<
|
|
93
|
-
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
94
|
-
'queryKey' | 'queryFn' | 'initialData'
|
|
95
|
-
> & { initialData?: () => undefined },
|
|
39
|
+
options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
40
|
+
queryClient?: QueryClient,
|
|
96
41
|
): UseQueryResult<TData, TError>
|
|
97
42
|
|
|
98
43
|
export function useQuery<
|
|
99
44
|
TQueryFnData = unknown,
|
|
100
|
-
TError =
|
|
45
|
+
TError = RegisteredError,
|
|
101
46
|
TData = TQueryFnData,
|
|
102
47
|
TQueryKey extends QueryKey = QueryKey,
|
|
103
48
|
>(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
options?: Omit<
|
|
107
|
-
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
108
|
-
'queryKey' | 'queryFn' | 'initialData'
|
|
109
|
-
> & { initialData: TQueryFnData | (() => TQueryFnData) },
|
|
49
|
+
options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
50
|
+
queryClient?: QueryClient,
|
|
110
51
|
): DefinedUseQueryResult<TData, TError>
|
|
111
52
|
|
|
112
53
|
export function useQuery<
|
|
113
54
|
TQueryFnData = unknown,
|
|
114
|
-
TError =
|
|
55
|
+
TError = RegisteredError,
|
|
115
56
|
TData = TQueryFnData,
|
|
116
57
|
TQueryKey extends QueryKey = QueryKey,
|
|
117
58
|
>(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
'queryKey' | 'queryFn'
|
|
123
|
-
>,
|
|
124
|
-
): UseQueryResult<TData, TError>
|
|
125
|
-
|
|
126
|
-
export function useQuery<
|
|
127
|
-
TQueryFnData,
|
|
128
|
-
TError,
|
|
129
|
-
TData = TQueryFnData,
|
|
130
|
-
TQueryKey extends QueryKey = QueryKey,
|
|
131
|
-
>(
|
|
132
|
-
arg1: TQueryKey | UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
133
|
-
arg2?:
|
|
134
|
-
| QueryFunction<TQueryFnData, TQueryKey>
|
|
135
|
-
| UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
136
|
-
arg3?: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
137
|
-
): UseQueryResult<TData, TError> {
|
|
138
|
-
const parsedOptions = parseQueryArgs(arg1, arg2, arg3)
|
|
139
|
-
return useBaseQuery(parsedOptions, QueryObserver)
|
|
59
|
+
options: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
60
|
+
queryClient?: QueryClient,
|
|
61
|
+
) {
|
|
62
|
+
return useBaseQuery(options, QueryObserver, queryClient)
|
|
140
63
|
}
|
package/src/utils.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export function shouldThrowError<T extends (...args: any[]) => boolean>(
|
|
2
|
-
|
|
2
|
+
throwError: boolean | T | undefined,
|
|
3
3
|
params: Parameters<T>,
|
|
4
4
|
): boolean {
|
|
5
|
-
// Allow
|
|
6
|
-
if (typeof
|
|
7
|
-
return
|
|
5
|
+
// Allow throwError function to override throwing behavior on a per-error basis
|
|
6
|
+
if (typeof throwError === 'function') {
|
|
7
|
+
return throwError(...params)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
return !!
|
|
10
|
+
return !!throwError
|
|
11
11
|
}
|
package/build/lib/Hydrate.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { HydrateOptions } from '@tanstack/query-core';
|
|
3
|
-
import type { ContextOptions } from './types';
|
|
4
|
-
export declare function useHydrate(state: unknown, options?: HydrateOptions & ContextOptions): void;
|
|
5
|
-
export interface HydrateProps {
|
|
6
|
-
state?: unknown;
|
|
7
|
-
options?: HydrateOptions;
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
export declare const Hydrate: ({ children, options, state }: HydrateProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Hydrate.esm.js","sources":["../../src/Hydrate.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { HydrateOptions } from '@tanstack/query-core'\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type { ContextOptions } from './types'\n\nexport function useHydrate(\n state: unknown,\n options: HydrateOptions & ContextOptions = {},\n) {\n const queryClient = useQueryClient({ context: options.context })\n\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n\n // Running hydrate again with the same queries is safe,\n // it wont overwrite or initialize existing queries,\n // relying on useMemo here is only a performance optimization.\n // hydrate can and should be run *during* render here for SSR to work properly\n React.useMemo(() => {\n if (state) {\n hydrate(queryClient, state, optionsRef.current)\n }\n }, [queryClient, state])\n}\n\nexport interface HydrateProps {\n state?: unknown\n options?: HydrateOptions\n children?: React.ReactNode\n}\n\nexport const Hydrate = ({ children, options, state }: HydrateProps) => {\n useHydrate(state, options)\n return children as React.ReactElement\n}\n"],"names":["useHydrate","state","options","queryClient","useQueryClient","context","optionsRef","React","useRef","current","useMemo","hydrate","Hydrate","children"],"mappings":";;;;AAQO,SAASA,UAAT,CACLC,KADK,EAELC,OAAwC,GAAG,EAFtC,EAGL;EACA,MAAMC,WAAW,GAAGC,cAAc,CAAC;IAAEC,OAAO,EAAEH,OAAO,CAACG,OAAAA;AAAnB,GAAD,CAAlC,CAAA;AAEA,EAAA,MAAMC,UAAU,GAAGC,KAAK,CAACC,MAAN,CAAaN,OAAb,CAAnB,CAAA;AACAI,EAAAA,UAAU,CAACG,OAAX,GAAqBP,OAArB,CAJA;AAOA;AACA;AACA;;EACAK,KAAK,CAACG,OAAN,CAAc,MAAM;AAClB,IAAA,IAAIT,KAAJ,EAAW;MACTU,OAAO,CAACR,WAAD,EAAcF,KAAd,EAAqBK,UAAU,CAACG,OAAhC,CAAP,CAAA;AACD,KAAA;AACF,GAJD,EAIG,CAACN,WAAD,EAAcF,KAAd,CAJH,CAAA,CAAA;AAKD,CAAA;AAQM,MAAMW,OAAO,GAAG,CAAC;EAAEC,QAAF;EAAYX,OAAZ;AAAqBD,EAAAA,KAAAA;AAArB,CAAD,KAAgD;AACrED,EAAAA,UAAU,CAACC,KAAD,EAAQC,OAAR,CAAV,CAAA;AACA,EAAA,OAAOW,QAAP,CAAA;AACD;;;;"}
|
package/build/lib/Hydrate.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Hydrate.js","sources":["../../src/Hydrate.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { HydrateOptions } from '@tanstack/query-core'\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type { ContextOptions } from './types'\n\nexport function useHydrate(\n state: unknown,\n options: HydrateOptions & ContextOptions = {},\n) {\n const queryClient = useQueryClient({ context: options.context })\n\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n\n // Running hydrate again with the same queries is safe,\n // it wont overwrite or initialize existing queries,\n // relying on useMemo here is only a performance optimization.\n // hydrate can and should be run *during* render here for SSR to work properly\n React.useMemo(() => {\n if (state) {\n hydrate(queryClient, state, optionsRef.current)\n }\n }, [queryClient, state])\n}\n\nexport interface HydrateProps {\n state?: unknown\n options?: HydrateOptions\n children?: React.ReactNode\n}\n\nexport const Hydrate = ({ children, options, state }: HydrateProps) => {\n useHydrate(state, options)\n return children as React.ReactElement\n}\n"],"names":["useHydrate","state","options","queryClient","useQueryClient","context","optionsRef","React","useRef","current","useMemo","hydrate","Hydrate","children"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,SAASA,UAAT,CACLC,KADK,EAELC,OAAwC,GAAG,EAFtC,EAGL;EACA,MAAMC,WAAW,GAAGC,kCAAc,CAAC;IAAEC,OAAO,EAAEH,OAAO,CAACG,OAAAA;AAAnB,GAAD,CAAlC,CAAA;AAEA,EAAA,MAAMC,UAAU,GAAGC,gBAAK,CAACC,MAAN,CAAaN,OAAb,CAAnB,CAAA;AACAI,EAAAA,UAAU,CAACG,OAAX,GAAqBP,OAArB,CAJA;AAOA;AACA;AACA;;EACAK,gBAAK,CAACG,OAAN,CAAc,MAAM;AAClB,IAAA,IAAIT,KAAJ,EAAW;MACTU,iBAAO,CAACR,WAAD,EAAcF,KAAd,EAAqBK,UAAU,CAACG,OAAhC,CAAP,CAAA;AACD,KAAA;AACF,GAJD,EAIG,CAACN,WAAD,EAAcF,KAAd,CAJH,CAAA,CAAA;AAKD,CAAA;AAQM,MAAMW,OAAO,GAAG,CAAC;EAAEC,QAAF;EAAYX,OAAZ;AAAqBD,EAAAA,KAAAA;AAArB,CAAD,KAAgD;AACrED,EAAAA,UAAU,CAACC,KAAD,EAAQC,OAAR,CAAV,CAAA;AACA,EAAA,OAAOW,QAAP,CAAA;AACD;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Hydrate.mjs","sources":["../../src/Hydrate.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { HydrateOptions } from '@tanstack/query-core'\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type { ContextOptions } from './types'\n\nexport function useHydrate(\n state: unknown,\n options: HydrateOptions & ContextOptions = {},\n) {\n const queryClient = useQueryClient({ context: options.context })\n\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n\n // Running hydrate again with the same queries is safe,\n // it wont overwrite or initialize existing queries,\n // relying on useMemo here is only a performance optimization.\n // hydrate can and should be run *during* render here for SSR to work properly\n React.useMemo(() => {\n if (state) {\n hydrate(queryClient, state, optionsRef.current)\n }\n }, [queryClient, state])\n}\n\nexport interface HydrateProps {\n state?: unknown\n options?: HydrateOptions\n children?: React.ReactNode\n}\n\nexport const Hydrate = ({ children, options, state }: HydrateProps) => {\n useHydrate(state, options)\n return children as React.ReactElement\n}\n"],"names":["useHydrate","state","options","queryClient","useQueryClient","context","optionsRef","React","useRef","current","useMemo","hydrate","Hydrate","children"],"mappings":";;;;AAQO,SAASA,UAAT,CACLC,KADK,EAELC,OAAwC,GAAG,EAFtC,EAGL;EACA,MAAMC,WAAW,GAAGC,cAAc,CAAC;IAAEC,OAAO,EAAEH,OAAO,CAACG,OAAAA;AAAnB,GAAD,CAAlC,CAAA;AAEA,EAAA,MAAMC,UAAU,GAAGC,KAAK,CAACC,MAAN,CAAaN,OAAb,CAAnB,CAAA;AACAI,EAAAA,UAAU,CAACG,OAAX,GAAqBP,OAArB,CAJA;AAOA;AACA;AACA;;EACAK,KAAK,CAACG,OAAN,CAAc,MAAM;AAClB,IAAA,IAAIT,KAAJ,EAAW;MACTU,OAAO,CAACR,WAAD,EAAcF,KAAd,EAAqBK,UAAU,CAACG,OAAhC,CAAP,CAAA;AACD,KAAA;AACF,GAJD,EAIG,CAACN,WAAD,EAAcF,KAAd,CAJH,CAAA,CAAA;AAKD,CAAA;AAQM,MAAMW,OAAO,GAAG,CAAC;EAAEC,QAAF;EAAYX,OAAZ;AAAqBD,EAAAA,KAAAA;AAArB,CAAD,KAAgD;AACrED,EAAAA,UAAU,CAACC,KAAD,EAAQC,OAAR,CAAV,CAAA;AACA,EAAA,OAAOW,QAAP,CAAA;AACD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reactBatchedUpdates.esm.js","sources":["../../src/reactBatchedUpdates.ts"],"sourcesContent":["import * as ReactDOM from 'react-dom'\nexport const unstable_batchedUpdates = ReactDOM.unstable_batchedUpdates\n"],"names":["unstable_batchedUpdates","ReactDOM"],"mappings":";;AACaA,MAAAA,uBAAuB,GAAGC,QAAQ,CAACD;;;;"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var ReactDOM = require('react-dom');
|
|
6
|
-
|
|
7
|
-
function _interopNamespace(e) {
|
|
8
|
-
if (e && e.__esModule) return e;
|
|
9
|
-
var n = Object.create(null);
|
|
10
|
-
if (e) {
|
|
11
|
-
Object.keys(e).forEach(function (k) {
|
|
12
|
-
if (k !== 'default') {
|
|
13
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () { return e[k]; }
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
n["default"] = e;
|
|
22
|
-
return Object.freeze(n);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
26
|
-
|
|
27
|
-
const unstable_batchedUpdates = ReactDOM__namespace.unstable_batchedUpdates;
|
|
28
|
-
|
|
29
|
-
exports.unstable_batchedUpdates = unstable_batchedUpdates;
|
|
30
|
-
//# sourceMappingURL=reactBatchedUpdates.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reactBatchedUpdates.js","sources":["../../src/reactBatchedUpdates.ts"],"sourcesContent":["import * as ReactDOM from 'react-dom'\nexport const unstable_batchedUpdates = ReactDOM.unstable_batchedUpdates\n"],"names":["unstable_batchedUpdates","ReactDOM"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACaA,MAAAA,uBAAuB,GAAGC,mBAAQ,CAACD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reactBatchedUpdates.mjs","sources":["../../src/reactBatchedUpdates.ts"],"sourcesContent":["import * as ReactDOM from 'react-dom'\nexport const unstable_batchedUpdates = ReactDOM.unstable_batchedUpdates\n"],"names":["unstable_batchedUpdates","ReactDOM"],"mappings":";;AACaA,MAAAA,uBAAuB,GAAGC,QAAQ,CAACD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reactBatchedUpdates.native.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var reactNative = require('react-native');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, 'unstable_batchedUpdates', {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () { return reactNative.unstable_batchedUpdates; }
|
|
12
|
-
});
|
|
13
|
-
//# sourceMappingURL=reactBatchedUpdates.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reactBatchedUpdates.native.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reactBatchedUpdates.native.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setBatchUpdatesFn.esm.js","sources":["../../src/setBatchUpdatesFn.ts"],"sourcesContent":["import { notifyManager } from '@tanstack/query-core'\nimport { unstable_batchedUpdates } from './reactBatchedUpdates'\n\nnotifyManager.setBatchNotifyFunction(unstable_batchedUpdates)\n"],"names":["notifyManager","setBatchNotifyFunction","unstable_batchedUpdates"],"mappings":";;;AAGAA,aAAa,CAACC,sBAAd,CAAqCC,uBAArC,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var queryCore = require('@tanstack/query-core');
|
|
4
|
-
var reactBatchedUpdates = require('./reactBatchedUpdates');
|
|
5
|
-
|
|
6
|
-
queryCore.notifyManager.setBatchNotifyFunction(reactBatchedUpdates.unstable_batchedUpdates);
|
|
7
|
-
//# sourceMappingURL=setBatchUpdatesFn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setBatchUpdatesFn.js","sources":["../../src/setBatchUpdatesFn.ts"],"sourcesContent":["import { notifyManager } from '@tanstack/query-core'\nimport { unstable_batchedUpdates } from './reactBatchedUpdates'\n\nnotifyManager.setBatchNotifyFunction(unstable_batchedUpdates)\n"],"names":["notifyManager","setBatchNotifyFunction","unstable_batchedUpdates"],"mappings":";;;;;AAGAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAa,CAACC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAd,CAAqCC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAArC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setBatchUpdatesFn.mjs","sources":["../../src/setBatchUpdatesFn.ts"],"sourcesContent":["import { notifyManager } from '@tanstack/query-core'\nimport { unstable_batchedUpdates } from './reactBatchedUpdates'\n\nnotifyManager.setBatchNotifyFunction(unstable_batchedUpdates)\n"],"names":["notifyManager","setBatchNotifyFunction","unstable_batchedUpdates"],"mappings":";;;AAGAA,aAAa,CAACC,sBAAd,CAAqCC,uBAArC,CAAA"}
|