@tanstack/query-core 5.104.0 → 5.104.2
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/legacy/environmentManager.cjs +3 -1
- package/build/legacy/environmentManager.cjs.map +1 -1
- package/build/legacy/environmentManager.d.cts +6 -1
- package/build/legacy/environmentManager.d.cts.map +1 -1
- package/build/legacy/environmentManager.d.ts +6 -1
- package/build/legacy/environmentManager.d.ts.map +1 -1
- package/build/legacy/environmentManager.js +3 -1
- package/build/legacy/environmentManager.js.map +1 -1
- package/build/legacy/focusManager.cjs +4 -2
- package/build/legacy/focusManager.cjs.map +1 -1
- package/build/legacy/focusManager.d.cts +5 -3
- package/build/legacy/focusManager.d.cts.map +1 -1
- package/build/legacy/focusManager.d.ts +5 -3
- package/build/legacy/focusManager.d.ts.map +1 -1
- package/build/legacy/focusManager.js +4 -2
- package/build/legacy/focusManager.js.map +1 -1
- package/build/legacy/{hydration-B9t5w6NC.d.ts → hydration-Dfuxd5FW.d.cts} +1410 -128
- package/build/legacy/hydration-Dfuxd5FW.d.cts.map +1 -0
- package/build/legacy/{hydration-Br9VIGXa.d.cts → hydration-UAqdtMIf.d.ts} +1410 -128
- package/build/legacy/hydration-UAqdtMIf.d.ts.map +1 -0
- package/build/legacy/hydration.cjs +35 -0
- package/build/legacy/hydration.cjs.map +1 -1
- package/build/legacy/hydration.d.cts +1 -1
- package/build/legacy/hydration.d.ts +1 -1
- package/build/legacy/hydration.js +35 -0
- package/build/legacy/hydration.js.map +1 -1
- package/build/legacy/index.d.cts +1 -1
- package/build/legacy/index.d.ts +1 -1
- package/build/legacy/infiniteQueryBehavior.cjs +29 -0
- package/build/legacy/infiniteQueryBehavior.cjs.map +1 -1
- package/build/legacy/infiniteQueryBehavior.d.cts +16 -1
- package/build/legacy/infiniteQueryBehavior.d.cts.map +1 -1
- package/build/legacy/infiniteQueryBehavior.d.ts +16 -1
- package/build/legacy/infiniteQueryBehavior.d.ts.map +1 -1
- package/build/legacy/infiniteQueryBehavior.js +29 -0
- package/build/legacy/infiniteQueryBehavior.js.map +1 -1
- package/build/legacy/infiniteQueryObserver.cjs +13 -7
- package/build/legacy/infiniteQueryObserver.cjs.map +1 -1
- package/build/legacy/infiniteQueryObserver.d.cts +15 -9
- package/build/legacy/infiniteQueryObserver.d.cts.map +1 -1
- package/build/legacy/infiniteQueryObserver.d.ts +15 -9
- package/build/legacy/infiniteQueryObserver.d.ts.map +1 -1
- package/build/legacy/infiniteQueryObserver.js +13 -7
- package/build/legacy/infiniteQueryObserver.js.map +1 -1
- package/build/legacy/mutation.cjs +27 -10
- package/build/legacy/mutation.cjs.map +1 -1
- package/build/legacy/mutation.d.cts +1 -1
- package/build/legacy/mutation.d.ts +1 -1
- package/build/legacy/mutation.js +27 -10
- package/build/legacy/mutation.js.map +1 -1
- package/build/legacy/mutationCache.cjs +53 -12
- package/build/legacy/mutationCache.cjs.map +1 -1
- package/build/legacy/mutationCache.d.cts +1 -1
- package/build/legacy/mutationCache.d.ts +1 -1
- package/build/legacy/mutationCache.js +53 -12
- package/build/legacy/mutationCache.js.map +1 -1
- package/build/legacy/mutationObserver.cjs +27 -16
- package/build/legacy/mutationObserver.cjs.map +1 -1
- package/build/legacy/mutationObserver.d.cts +1 -1
- package/build/legacy/mutationObserver.d.ts +1 -1
- package/build/legacy/mutationObserver.js +27 -16
- package/build/legacy/mutationObserver.js.map +1 -1
- package/build/legacy/notifyManager.cjs +12 -2
- package/build/legacy/notifyManager.cjs.map +1 -1
- package/build/legacy/notifyManager.d.cts +19 -4
- package/build/legacy/notifyManager.d.cts.map +1 -1
- package/build/legacy/notifyManager.d.ts +19 -4
- package/build/legacy/notifyManager.d.ts.map +1 -1
- package/build/legacy/notifyManager.js +12 -2
- package/build/legacy/notifyManager.js.map +1 -1
- package/build/legacy/onlineManager.cjs +4 -2
- package/build/legacy/onlineManager.cjs.map +1 -1
- package/build/legacy/onlineManager.d.cts +5 -3
- package/build/legacy/onlineManager.d.cts.map +1 -1
- package/build/legacy/onlineManager.d.ts +5 -3
- package/build/legacy/onlineManager.d.ts.map +1 -1
- package/build/legacy/onlineManager.js +4 -2
- package/build/legacy/onlineManager.js.map +1 -1
- package/build/legacy/queriesObserver.cjs +15 -3
- package/build/legacy/queriesObserver.cjs.map +1 -1
- package/build/legacy/queriesObserver.d.cts +14 -5
- package/build/legacy/queriesObserver.d.cts.map +1 -1
- package/build/legacy/queriesObserver.d.ts +14 -5
- package/build/legacy/queriesObserver.d.ts.map +1 -1
- package/build/legacy/queriesObserver.js +15 -3
- package/build/legacy/queriesObserver.js.map +1 -1
- package/build/legacy/query.cjs +89 -15
- package/build/legacy/query.cjs.map +1 -1
- package/build/legacy/query.d.cts +1 -1
- package/build/legacy/query.d.ts +1 -1
- package/build/legacy/query.js +89 -15
- package/build/legacy/query.js.map +1 -1
- package/build/legacy/queryCache.cjs +34 -12
- package/build/legacy/queryCache.cjs.map +1 -1
- package/build/legacy/queryCache.d.cts +1 -1
- package/build/legacy/queryCache.d.ts +1 -1
- package/build/legacy/queryCache.js +34 -12
- package/build/legacy/queryCache.js.map +1 -1
- package/build/legacy/queryClient.cjs +104 -32
- package/build/legacy/queryClient.cjs.map +1 -1
- package/build/legacy/queryClient.d.cts +1 -1
- package/build/legacy/queryClient.d.ts +1 -1
- package/build/legacy/queryClient.js +104 -32
- package/build/legacy/queryClient.js.map +1 -1
- package/build/legacy/queryObserver.cjs +78 -6
- package/build/legacy/queryObserver.cjs.map +1 -1
- package/build/legacy/queryObserver.d.cts +1 -1
- package/build/legacy/queryObserver.d.ts +1 -1
- package/build/legacy/queryObserver.js +78 -6
- package/build/legacy/queryObserver.js.map +1 -1
- package/build/{modern/removable-0GzhW1PK.d.cts → legacy/removable-Cw9GNGyK.d.cts} +17 -1
- package/build/legacy/removable-Cw9GNGyK.d.cts.map +1 -0
- package/build/legacy/{removable-0GzhW1PK.d.cts → removable-Cw9GNGyK.d.ts} +17 -1
- package/build/legacy/removable-Cw9GNGyK.d.ts.map +1 -0
- package/build/legacy/removable.cjs +12 -0
- package/build/legacy/removable.cjs.map +1 -1
- package/build/legacy/removable.d.cts +1 -1
- package/build/legacy/removable.d.ts +1 -1
- package/build/legacy/removable.js +12 -0
- package/build/legacy/removable.js.map +1 -1
- package/build/legacy/retryer.cjs +26 -4
- package/build/legacy/retryer.cjs.map +1 -1
- package/build/legacy/retryer.d.cts +1 -1
- package/build/legacy/retryer.d.ts +1 -1
- package/build/legacy/retryer.js +26 -4
- package/build/legacy/retryer.js.map +1 -1
- package/build/legacy/streamedQuery.cjs +3 -1
- package/build/legacy/streamedQuery.cjs.map +1 -1
- package/build/legacy/streamedQuery.d.cts +4 -2
- package/build/legacy/streamedQuery.d.cts.map +1 -1
- package/build/legacy/streamedQuery.d.ts +4 -2
- package/build/legacy/streamedQuery.d.ts.map +1 -1
- package/build/legacy/streamedQuery.js +3 -1
- package/build/legacy/streamedQuery.js.map +1 -1
- package/build/{modern/subscribable-CysQ0tne.d.cts → legacy/subscribable-czlHOxMP.d.cts} +11 -1
- package/build/legacy/subscribable-czlHOxMP.d.cts.map +1 -0
- package/build/legacy/{subscribable-CysQ0tne.d.cts → subscribable-czlHOxMP.d.ts} +11 -1
- package/build/legacy/subscribable-czlHOxMP.d.ts.map +1 -0
- package/build/legacy/subscribable.cjs +10 -0
- package/build/legacy/subscribable.cjs.map +1 -1
- package/build/legacy/subscribable.d.cts +1 -1
- package/build/legacy/subscribable.d.ts +1 -1
- package/build/legacy/subscribable.js +10 -0
- package/build/legacy/subscribable.js.map +1 -1
- package/build/legacy/timeoutManager.cjs +11 -6
- package/build/legacy/timeoutManager.cjs.map +1 -1
- package/build/legacy/timeoutManager.d.cts +23 -6
- package/build/legacy/timeoutManager.d.cts.map +1 -1
- package/build/legacy/timeoutManager.d.ts +23 -6
- package/build/legacy/timeoutManager.d.ts.map +1 -1
- package/build/legacy/timeoutManager.js +11 -6
- package/build/legacy/timeoutManager.js.map +1 -1
- package/build/legacy/types.cjs.map +1 -1
- package/build/legacy/types.d.cts +1 -1
- package/build/legacy/types.d.ts +1 -1
- package/build/legacy/types.js.map +1 -1
- package/build/legacy/utils.cjs +117 -8
- package/build/legacy/utils.cjs.map +1 -1
- package/build/legacy/utils.d.cts +1 -1
- package/build/legacy/utils.d.ts +1 -1
- package/build/legacy/utils.js +117 -8
- package/build/legacy/utils.js.map +1 -1
- package/build/modern/environmentManager.cjs +3 -1
- package/build/modern/environmentManager.cjs.map +1 -1
- package/build/modern/environmentManager.d.cts +6 -1
- package/build/modern/environmentManager.d.cts.map +1 -1
- package/build/modern/environmentManager.d.ts +6 -1
- package/build/modern/environmentManager.d.ts.map +1 -1
- package/build/modern/environmentManager.js +3 -1
- package/build/modern/environmentManager.js.map +1 -1
- package/build/modern/focusManager.cjs +4 -2
- package/build/modern/focusManager.cjs.map +1 -1
- package/build/modern/focusManager.d.cts +5 -3
- package/build/modern/focusManager.d.cts.map +1 -1
- package/build/modern/focusManager.d.ts +5 -3
- package/build/modern/focusManager.d.ts.map +1 -1
- package/build/modern/focusManager.js +4 -2
- package/build/modern/focusManager.js.map +1 -1
- package/build/modern/{hydration-B9t5w6NC.d.ts → hydration-Dfuxd5FW.d.cts} +1410 -128
- package/build/modern/hydration-Dfuxd5FW.d.cts.map +1 -0
- package/build/modern/{hydration-Br9VIGXa.d.cts → hydration-UAqdtMIf.d.ts} +1410 -128
- package/build/modern/hydration-UAqdtMIf.d.ts.map +1 -0
- package/build/modern/hydration.cjs +35 -0
- package/build/modern/hydration.cjs.map +1 -1
- package/build/modern/hydration.d.cts +1 -1
- package/build/modern/hydration.d.ts +1 -1
- package/build/modern/hydration.js +35 -0
- package/build/modern/hydration.js.map +1 -1
- package/build/modern/index.d.cts +1 -1
- package/build/modern/index.d.ts +1 -1
- package/build/modern/infiniteQueryBehavior.cjs +29 -0
- package/build/modern/infiniteQueryBehavior.cjs.map +1 -1
- package/build/modern/infiniteQueryBehavior.d.cts +16 -1
- package/build/modern/infiniteQueryBehavior.d.cts.map +1 -1
- package/build/modern/infiniteQueryBehavior.d.ts +16 -1
- package/build/modern/infiniteQueryBehavior.d.ts.map +1 -1
- package/build/modern/infiniteQueryBehavior.js +29 -0
- package/build/modern/infiniteQueryBehavior.js.map +1 -1
- package/build/modern/infiniteQueryObserver.cjs +13 -7
- package/build/modern/infiniteQueryObserver.cjs.map +1 -1
- package/build/modern/infiniteQueryObserver.d.cts +15 -9
- package/build/modern/infiniteQueryObserver.d.cts.map +1 -1
- package/build/modern/infiniteQueryObserver.d.ts +15 -9
- package/build/modern/infiniteQueryObserver.d.ts.map +1 -1
- package/build/modern/infiniteQueryObserver.js +13 -7
- package/build/modern/infiniteQueryObserver.js.map +1 -1
- package/build/modern/mutation.cjs +27 -10
- package/build/modern/mutation.cjs.map +1 -1
- package/build/modern/mutation.d.cts +1 -1
- package/build/modern/mutation.d.ts +1 -1
- package/build/modern/mutation.js +27 -10
- package/build/modern/mutation.js.map +1 -1
- package/build/modern/mutationCache.cjs +53 -12
- package/build/modern/mutationCache.cjs.map +1 -1
- package/build/modern/mutationCache.d.cts +1 -1
- package/build/modern/mutationCache.d.ts +1 -1
- package/build/modern/mutationCache.js +53 -12
- package/build/modern/mutationCache.js.map +1 -1
- package/build/modern/mutationObserver.cjs +23 -12
- package/build/modern/mutationObserver.cjs.map +1 -1
- package/build/modern/mutationObserver.d.cts +1 -1
- package/build/modern/mutationObserver.d.ts +1 -1
- package/build/modern/mutationObserver.js +23 -12
- package/build/modern/mutationObserver.js.map +1 -1
- package/build/modern/notifyManager.cjs +12 -2
- package/build/modern/notifyManager.cjs.map +1 -1
- package/build/modern/notifyManager.d.cts +19 -4
- package/build/modern/notifyManager.d.cts.map +1 -1
- package/build/modern/notifyManager.d.ts +19 -4
- package/build/modern/notifyManager.d.ts.map +1 -1
- package/build/modern/notifyManager.js +12 -2
- package/build/modern/notifyManager.js.map +1 -1
- package/build/modern/onlineManager.cjs +4 -2
- package/build/modern/onlineManager.cjs.map +1 -1
- package/build/modern/onlineManager.d.cts +5 -3
- package/build/modern/onlineManager.d.cts.map +1 -1
- package/build/modern/onlineManager.d.ts +5 -3
- package/build/modern/onlineManager.d.ts.map +1 -1
- package/build/modern/onlineManager.js +4 -2
- package/build/modern/onlineManager.js.map +1 -1
- package/build/modern/queriesObserver.cjs +15 -3
- package/build/modern/queriesObserver.cjs.map +1 -1
- package/build/modern/queriesObserver.d.cts +14 -5
- package/build/modern/queriesObserver.d.cts.map +1 -1
- package/build/modern/queriesObserver.d.ts +14 -5
- package/build/modern/queriesObserver.d.ts.map +1 -1
- package/build/modern/queriesObserver.js +15 -3
- package/build/modern/queriesObserver.js.map +1 -1
- package/build/modern/query.cjs +89 -15
- package/build/modern/query.cjs.map +1 -1
- package/build/modern/query.d.cts +1 -1
- package/build/modern/query.d.ts +1 -1
- package/build/modern/query.js +89 -15
- package/build/modern/query.js.map +1 -1
- package/build/modern/queryCache.cjs +34 -12
- package/build/modern/queryCache.cjs.map +1 -1
- package/build/modern/queryCache.d.cts +1 -1
- package/build/modern/queryCache.d.ts +1 -1
- package/build/modern/queryCache.js +34 -12
- package/build/modern/queryCache.js.map +1 -1
- package/build/modern/queryClient.cjs +104 -32
- package/build/modern/queryClient.cjs.map +1 -1
- package/build/modern/queryClient.d.cts +1 -1
- package/build/modern/queryClient.d.ts +1 -1
- package/build/modern/queryClient.js +104 -32
- package/build/modern/queryClient.js.map +1 -1
- package/build/modern/queryObserver.cjs +78 -6
- package/build/modern/queryObserver.cjs.map +1 -1
- package/build/modern/queryObserver.d.cts +1 -1
- package/build/modern/queryObserver.d.ts +1 -1
- package/build/modern/queryObserver.js +78 -6
- package/build/modern/queryObserver.js.map +1 -1
- package/build/modern/{removable-0GzhW1PK.d.ts → removable-Cw9GNGyK.d.cts} +17 -1
- package/build/modern/removable-Cw9GNGyK.d.cts.map +1 -0
- package/build/{legacy/removable-0GzhW1PK.d.ts → modern/removable-Cw9GNGyK.d.ts} +17 -1
- package/build/modern/removable-Cw9GNGyK.d.ts.map +1 -0
- package/build/modern/removable.cjs +12 -0
- package/build/modern/removable.cjs.map +1 -1
- package/build/modern/removable.d.cts +1 -1
- package/build/modern/removable.d.ts +1 -1
- package/build/modern/removable.js +12 -0
- package/build/modern/removable.js.map +1 -1
- package/build/modern/retryer.cjs +26 -4
- package/build/modern/retryer.cjs.map +1 -1
- package/build/modern/retryer.d.cts +1 -1
- package/build/modern/retryer.d.ts +1 -1
- package/build/modern/retryer.js +26 -4
- package/build/modern/retryer.js.map +1 -1
- package/build/modern/streamedQuery.cjs +3 -1
- package/build/modern/streamedQuery.cjs.map +1 -1
- package/build/modern/streamedQuery.d.cts +4 -2
- package/build/modern/streamedQuery.d.cts.map +1 -1
- package/build/modern/streamedQuery.d.ts +4 -2
- package/build/modern/streamedQuery.d.ts.map +1 -1
- package/build/modern/streamedQuery.js +3 -1
- package/build/modern/streamedQuery.js.map +1 -1
- package/build/modern/{subscribable-CysQ0tne.d.ts → subscribable-czlHOxMP.d.cts} +11 -1
- package/build/modern/subscribable-czlHOxMP.d.cts.map +1 -0
- package/build/{legacy/subscribable-CysQ0tne.d.ts → modern/subscribable-czlHOxMP.d.ts} +11 -1
- package/build/modern/subscribable-czlHOxMP.d.ts.map +1 -0
- package/build/modern/subscribable.cjs +10 -0
- package/build/modern/subscribable.cjs.map +1 -1
- package/build/modern/subscribable.d.cts +1 -1
- package/build/modern/subscribable.d.ts +1 -1
- package/build/modern/subscribable.js +10 -0
- package/build/modern/subscribable.js.map +1 -1
- package/build/modern/timeoutManager.cjs +11 -6
- package/build/modern/timeoutManager.cjs.map +1 -1
- package/build/modern/timeoutManager.d.cts +23 -6
- package/build/modern/timeoutManager.d.cts.map +1 -1
- package/build/modern/timeoutManager.d.ts +23 -6
- package/build/modern/timeoutManager.d.ts.map +1 -1
- package/build/modern/timeoutManager.js +11 -6
- package/build/modern/timeoutManager.js.map +1 -1
- package/build/modern/types.cjs.map +1 -1
- package/build/modern/types.d.cts +1 -1
- package/build/modern/types.d.ts +1 -1
- package/build/modern/types.js.map +1 -1
- package/build/modern/utils.cjs +117 -8
- package/build/modern/utils.cjs.map +1 -1
- package/build/modern/utils.d.cts +1 -1
- package/build/modern/utils.d.ts +1 -1
- package/build/modern/utils.js +117 -8
- package/build/modern/utils.js.map +1 -1
- package/package.json +4 -4
- package/src/environmentManager.ts +6 -1
- package/src/focusManager.ts +8 -6
- package/src/hydration.ts +42 -1
- package/src/infiniteQueryBehavior.ts +29 -0
- package/src/infiniteQueryObserver.ts +20 -14
- package/src/mutation.ts +32 -11
- package/src/mutationCache.ts +53 -12
- package/src/mutationObserver.ts +29 -14
- package/src/notifyManager.ts +12 -2
- package/src/onlineManager.ts +7 -5
- package/src/queriesObserver.ts +20 -5
- package/src/query.ts +153 -20
- package/src/queryCache.ts +54 -13
- package/src/queryClient.ts +110 -38
- package/src/queryObserver.ts +88 -12
- package/src/removable.ts +16 -0
- package/src/retryer.ts +57 -4
- package/src/streamedQuery.ts +4 -3
- package/src/subscribable.ts +10 -0
- package/src/timeoutManager.ts +23 -6
- package/src/types.ts +801 -27
- package/src/utils.ts +130 -10
- package/build/legacy/hydration-B9t5w6NC.d.ts.map +0 -1
- package/build/legacy/hydration-Br9VIGXa.d.cts.map +0 -1
- package/build/legacy/removable-0GzhW1PK.d.cts.map +0 -1
- package/build/legacy/removable-0GzhW1PK.d.ts.map +0 -1
- package/build/legacy/subscribable-CysQ0tne.d.cts.map +0 -1
- package/build/legacy/subscribable-CysQ0tne.d.ts.map +0 -1
- package/build/modern/hydration-B9t5w6NC.d.ts.map +0 -1
- package/build/modern/hydration-Br9VIGXa.d.cts.map +0 -1
- package/build/modern/removable-0GzhW1PK.d.cts.map +0 -1
- package/build/modern/removable-0GzhW1PK.d.ts.map +0 -1
- package/build/modern/subscribable-CysQ0tne.d.cts.map +0 -1
- package/build/modern/subscribable-CysQ0tne.d.ts.map +0 -1
|
@@ -9,7 +9,6 @@ import { QueryCache } from "./queryCache.js";
|
|
|
9
9
|
* `QueryClient` is used to interact with a cache of queries and mutations. It owns a
|
|
10
10
|
* `QueryCache` and a `MutationCache` (creating default ones if none are passed in) and holds
|
|
11
11
|
* the default options that are applied to queries and mutations created through it.
|
|
12
|
-
*
|
|
13
12
|
* @example
|
|
14
13
|
* ```ts
|
|
15
14
|
* const queryClient = new QueryClient({
|
|
@@ -79,7 +78,9 @@ var QueryClient = class {
|
|
|
79
78
|
* Returns the number of queries in the cache that are currently fetching, optionally
|
|
80
79
|
* matching a set of filters. This includes background-fetching, loading new pages, and
|
|
81
80
|
* loading more infinite query results.
|
|
82
|
-
*
|
|
81
|
+
* @param filters - Narrows down which fetching queries are counted. Without filters, every
|
|
82
|
+
* fetching query is counted.
|
|
83
|
+
* @returns The number of matching queries whose `fetchStatus` is `'fetching'`.
|
|
83
84
|
* @example
|
|
84
85
|
* ```ts
|
|
85
86
|
* if (queryClient.isFetching()) {
|
|
@@ -96,7 +97,9 @@ var QueryClient = class {
|
|
|
96
97
|
/**
|
|
97
98
|
* Returns the number of mutations in the cache that are currently pending, optionally
|
|
98
99
|
* matching a set of filters.
|
|
99
|
-
*
|
|
100
|
+
* @param filters - Narrows down which pending mutations are counted. Without filters, every
|
|
101
|
+
* pending mutation is counted.
|
|
102
|
+
* @returns The number of matching mutations whose `status` is `'pending'`.
|
|
100
103
|
* @example
|
|
101
104
|
* ```ts
|
|
102
105
|
* if (queryClient.isMutating()) {
|
|
@@ -116,7 +119,7 @@ var QueryClient = class {
|
|
|
116
119
|
*
|
|
117
120
|
* Hint: Do not use this function inside a component, because it won't receive updates.
|
|
118
121
|
* Use `useQuery` to create a `QueryObserver` that subscribes to changes.
|
|
119
|
-
*
|
|
122
|
+
* @param queryKey - The query key of the query to read.
|
|
120
123
|
* @returns The cached data for the query, or `undefined` if no query with this key has been observed yet.
|
|
121
124
|
* @see {@link QueryClient#getQueriesData}
|
|
122
125
|
*/
|
|
@@ -125,6 +128,12 @@ var QueryClient = class {
|
|
|
125
128
|
return this.#queryCache.get(options.queryHash)?.state.data;
|
|
126
129
|
}
|
|
127
130
|
/**
|
|
131
|
+
* Returns the cached data of a query, or fetches it if there is none. With `revalidateIfStale`,
|
|
132
|
+
* stale cached data is also refetched in the background.
|
|
133
|
+
* @param options - The query options. If the query has no cached data yet, it is fetched with
|
|
134
|
+
* these options.
|
|
135
|
+
* @returns A promise that resolves to the cached data, or to the fetched data if nothing was
|
|
136
|
+
* cached yet.
|
|
128
137
|
* @deprecated Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.
|
|
129
138
|
*/
|
|
130
139
|
ensureQueryData(options) {
|
|
@@ -145,7 +154,7 @@ var QueryClient = class {
|
|
|
145
154
|
* than being inferred. Passing a more specific type is a convenience for call sites that know
|
|
146
155
|
* every matched query holds the same shape — it is not checked against the actual cache
|
|
147
156
|
* contents.
|
|
148
|
-
*
|
|
157
|
+
* @param filters - The filters that select which queries to read.
|
|
149
158
|
* @returns An array of query key and data pairs. The data is `undefined` for a query with no cached data.
|
|
150
159
|
* @see {@link QueryClient#getQueryData}
|
|
151
160
|
* @example
|
|
@@ -166,14 +175,12 @@ var QueryClient = class {
|
|
|
166
175
|
*
|
|
167
176
|
* Updates must be performed immutably: do not mutate `oldData`, or data previously retrieved
|
|
168
177
|
* via {@link QueryClient#getQueryData}, in place.
|
|
169
|
-
*
|
|
170
178
|
* @param queryKey - The query key to set data for.
|
|
171
179
|
* @param updater - Either the new data, or a function that receives the current data (which
|
|
172
180
|
* may be `undefined`) and returns the new data.
|
|
173
181
|
* @param options - Set `updatedAt` to override the timestamp the written data is recorded with.
|
|
174
182
|
* @returns The data that was written, or `undefined` if the updater returned `undefined` — in that case
|
|
175
183
|
* the write is skipped and the cache is left unchanged.
|
|
176
|
-
*
|
|
177
184
|
* @example
|
|
178
185
|
* ```ts
|
|
179
186
|
* queryClient.setQueryData(['posts'], newPosts)
|
|
@@ -197,7 +204,10 @@ var QueryClient = class {
|
|
|
197
204
|
* filters or partial query key matching. Only queries that already exist and match the given
|
|
198
205
|
* filters are updated; no new cache entries are created. Internally this calls
|
|
199
206
|
* {@link QueryClient#setQueryData} for each matching query.
|
|
200
|
-
*
|
|
207
|
+
* @param filters - The filters that select which existing queries to update.
|
|
208
|
+
* @param updater - Either the new data, or a function that receives each matched query's current
|
|
209
|
+
* data (which may be `undefined`) and returns the new data.
|
|
210
|
+
* @param options - Set `updatedAt` to override the timestamp the written data is recorded with.
|
|
201
211
|
* @returns One `[queryKey, data]` tuple per matched query, in the same shape and with the same
|
|
202
212
|
* `undefined` case as {@link QueryClient#setQueryData}.
|
|
203
213
|
* @example
|
|
@@ -213,7 +223,8 @@ var QueryClient = class {
|
|
|
213
223
|
/**
|
|
214
224
|
* Imperative (non-reactive) way to retrieve an existing query's state. If the query does not
|
|
215
225
|
* exist, `undefined` is returned.
|
|
216
|
-
*
|
|
226
|
+
* @param queryKey - The query key of the query to read.
|
|
227
|
+
* @returns The query's state, or `undefined` if no query with this key exists.
|
|
217
228
|
* @example
|
|
218
229
|
* ```ts
|
|
219
230
|
* const state = queryClient.getQueryState(['posts'])
|
|
@@ -229,7 +240,8 @@ var QueryClient = class {
|
|
|
229
240
|
* {@link QueryClient#invalidateQueries} or {@link QueryClient#refetchQueries}, this removes
|
|
230
241
|
* matching queries from the cache instead of refetching them. Without filters, every query in
|
|
231
242
|
* the cache is removed.
|
|
232
|
-
*
|
|
243
|
+
* @param filters - The filters that select which queries to remove. Without filters, every query
|
|
244
|
+
* is removed.
|
|
233
245
|
* @example
|
|
234
246
|
* ```ts
|
|
235
247
|
* queryClient.removeQueries({ queryKey: ['posts'], exact: true })
|
|
@@ -247,7 +259,11 @@ var QueryClient = class {
|
|
|
247
259
|
* Resets queries matching the given filters back to their initial state (e.g. any
|
|
248
260
|
* `initialData`), notifying subscribers rather than removing them. Active queries among the
|
|
249
261
|
* matched set are then refetched, and the returned promise resolves once that refetch settles.
|
|
250
|
-
*
|
|
262
|
+
* @param filters - The filters that select which queries to reset. Without filters, every query
|
|
263
|
+
* is reset.
|
|
264
|
+
* @param options - Passed to the refetch of the active matched queries, e.g. `cancelRefetch` and
|
|
265
|
+
* `throwOnError`.
|
|
266
|
+
* @returns A promise that resolves once the refetch of the active matched queries settles.
|
|
251
267
|
* @example
|
|
252
268
|
* ```ts
|
|
253
269
|
* await queryClient.resetQueries({ queryKey: ['posts'], exact: true })
|
|
@@ -274,7 +290,11 @@ var QueryClient = class {
|
|
|
274
290
|
* reverted to its state before the outgoing fetch started.
|
|
275
291
|
*
|
|
276
292
|
* The returned promise never rejects, even if individual cancellations fail.
|
|
277
|
-
*
|
|
293
|
+
* @param filters - The filters that select which queries to cancel. Without filters, every query
|
|
294
|
+
* is cancelled.
|
|
295
|
+
* @param cancelOptions - Passed to each matched query's cancellation. `revert` defaults to
|
|
296
|
+
* `true`.
|
|
297
|
+
* @returns A promise that resolves once every cancellation has settled.
|
|
278
298
|
* @example
|
|
279
299
|
* ```ts
|
|
280
300
|
* await queryClient.cancelQueries({ queryKey: ['posts'], exact: true })
|
|
@@ -295,7 +315,12 @@ var QueryClient = class {
|
|
|
295
315
|
* Unless `filters.refetchType` is `'none'`, matching queries are then refetched via
|
|
296
316
|
* {@link QueryClient#refetchQueries}, using `filters.refetchType` if set, otherwise
|
|
297
317
|
* `filters.type`, otherwise `'active'`.
|
|
298
|
-
*
|
|
318
|
+
* @param filters - The filters that select which queries to invalidate, plus `refetchType` to
|
|
319
|
+
* control which of them to refetch afterwards. Without filters, every query is invalidated.
|
|
320
|
+
* @param options - Passed to {@link QueryClient#refetchQueries}, e.g. `cancelRefetch` and
|
|
321
|
+
* `throwOnError`.
|
|
322
|
+
* @returns A promise that resolves once the refetch settles, or immediately if `refetchType` is
|
|
323
|
+
* `'none'`.
|
|
299
324
|
* @example
|
|
300
325
|
* ```ts
|
|
301
326
|
* await queryClient.invalidateQueries({ queryKey: ['posts'], refetchType: 'active' })
|
|
@@ -321,7 +346,11 @@ var QueryClient = class {
|
|
|
321
346
|
* By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new
|
|
322
347
|
* one starts. The returned promise resolves once all matching queries have settled; it does
|
|
323
348
|
* not reject on individual query failures unless `throwOnError` is set.
|
|
324
|
-
*
|
|
349
|
+
* @param filters - The filters that select which queries to refetch. Without filters, every query
|
|
350
|
+
* in the cache is included.
|
|
351
|
+
* @param options - Set `cancelRefetch` to `false` to keep a running fetch instead of cancelling
|
|
352
|
+
* it, and `throwOnError` to `true` to reject when a refetch fails.
|
|
353
|
+
* @returns A promise that resolves once every matched query has settled.
|
|
325
354
|
* @example
|
|
326
355
|
* ```ts
|
|
327
356
|
* // refetch all active queries partially matching a query key:
|
|
@@ -361,7 +390,10 @@ var QueryClient = class {
|
|
|
361
390
|
*
|
|
362
391
|
* This method replaces the deprecated `fetchQuery`, and — combined with
|
|
363
392
|
* `{ staleTime: 'static' }` — the deprecated `ensureQueryData`.
|
|
364
|
-
*
|
|
393
|
+
* @param options - The query options, including the `queryKey` and the `queryFn` used if the
|
|
394
|
+
* query needs to fetch.
|
|
395
|
+
* @returns A promise that resolves to the data, or to the result of `select` if provided. It
|
|
396
|
+
* rejects with the error from the fetch or from `select`.
|
|
365
397
|
* @example
|
|
366
398
|
* ```ts
|
|
367
399
|
* try {
|
|
@@ -381,6 +413,12 @@ var QueryClient = class {
|
|
|
381
413
|
return queryData;
|
|
382
414
|
}
|
|
383
415
|
/**
|
|
416
|
+
* Fetches and caches a query, or returns its cached data if it isn't stale. Unlike in observers,
|
|
417
|
+
* the fetch isn't retried unless `retry` is set.
|
|
418
|
+
* @param options - The query options, including the `queryKey` and the `queryFn` used if the
|
|
419
|
+
* query needs to fetch.
|
|
420
|
+
* @returns A promise that resolves to the cached or fetched data, or rejects with the fetch
|
|
421
|
+
* error.
|
|
384
422
|
* @deprecated Use queryClient.query(options) instead. This method will be removed in the next major version.
|
|
385
423
|
*/
|
|
386
424
|
fetchQuery(options) {
|
|
@@ -390,6 +428,11 @@ var QueryClient = class {
|
|
|
390
428
|
return query.isStaleByTime(resolveQueryValue(defaultedOptions.staleTime, query)) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
|
|
391
429
|
}
|
|
392
430
|
/**
|
|
431
|
+
* Fetches and caches a query like {@link QueryClient#fetchQuery}, but ignores the result and any
|
|
432
|
+
* error.
|
|
433
|
+
* @param options - The query options, including the `queryKey` and the `queryFn` used if the
|
|
434
|
+
* query needs to fetch.
|
|
435
|
+
* @returns A promise that resolves once the fetch settles. It never rejects.
|
|
393
436
|
* @deprecated Use queryClient.query(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.
|
|
394
437
|
*/
|
|
395
438
|
prefetchQuery(options) {
|
|
@@ -405,7 +448,10 @@ var QueryClient = class {
|
|
|
405
448
|
*
|
|
406
449
|
* This method replaces the deprecated `fetchInfiniteQuery`, and — combined with
|
|
407
450
|
* `{ staleTime: 'static' }` — the deprecated `ensureInfiniteQueryData`.
|
|
408
|
-
*
|
|
451
|
+
* @param options - The infinite query options, including the `queryKey`, the `queryFn`, and the
|
|
452
|
+
* `initialPageParam`.
|
|
453
|
+
* @returns A promise that resolves to the {@link InfiniteData}, or to the result of `select` if
|
|
454
|
+
* provided. It rejects with the error from the fetch or from `select`.
|
|
409
455
|
* @example
|
|
410
456
|
* ```ts
|
|
411
457
|
* try {
|
|
@@ -421,6 +467,11 @@ var QueryClient = class {
|
|
|
421
467
|
return this.query(options);
|
|
422
468
|
}
|
|
423
469
|
/**
|
|
470
|
+
* Fetches and caches an infinite query, or returns its cached data if it isn't stale.
|
|
471
|
+
* @param options - The infinite query options, including the `queryKey`, the `queryFn`, and the
|
|
472
|
+
* `initialPageParam`.
|
|
473
|
+
* @returns A promise that resolves to the cached or fetched {@link InfiniteData}, or rejects with
|
|
474
|
+
* the fetch error.
|
|
424
475
|
* @deprecated Use queryClient.infiniteQuery(options) instead. This method will be removed in the next major version.
|
|
425
476
|
*/
|
|
426
477
|
fetchInfiniteQuery(options) {
|
|
@@ -428,12 +479,23 @@ var QueryClient = class {
|
|
|
428
479
|
return this.fetchQuery(options);
|
|
429
480
|
}
|
|
430
481
|
/**
|
|
482
|
+
* Fetches and caches an infinite query like {@link QueryClient#fetchInfiniteQuery}, but ignores
|
|
483
|
+
* the result and any error.
|
|
484
|
+
* @param options - The infinite query options, including the `queryKey`, the `queryFn`, and the
|
|
485
|
+
* `initialPageParam`.
|
|
486
|
+
* @returns A promise that resolves once the fetch settles. It never rejects.
|
|
431
487
|
* @deprecated Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.
|
|
432
488
|
*/
|
|
433
489
|
prefetchInfiniteQuery(options) {
|
|
434
490
|
return this.fetchInfiniteQuery(options).then(noop).catch(noop);
|
|
435
491
|
}
|
|
436
492
|
/**
|
|
493
|
+
* Returns the cached data of an infinite query, or fetches it if there is none. With
|
|
494
|
+
* `revalidateIfStale`, stale cached data is also refetched in the background.
|
|
495
|
+
* @param options - The infinite query options. If the query has no cached data yet, it is fetched
|
|
496
|
+
* with these options.
|
|
497
|
+
* @returns A promise that resolves to the cached {@link InfiniteData}, or to the fetched data if
|
|
498
|
+
* nothing was cached yet.
|
|
437
499
|
* @deprecated Use queryClient.infiniteQuery({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.
|
|
438
500
|
*/
|
|
439
501
|
ensureInfiniteQueryData(options) {
|
|
@@ -443,7 +505,7 @@ var QueryClient = class {
|
|
|
443
505
|
/**
|
|
444
506
|
* Resumes mutations that were paused because there was no network connection. Does nothing
|
|
445
507
|
* (resolving immediately) if the client is currently offline.
|
|
446
|
-
*
|
|
508
|
+
* @returns A promise that resolves once the resumed mutations have settled.
|
|
447
509
|
* @example
|
|
448
510
|
* ```ts
|
|
449
511
|
* import { QueryClient } from '@tanstack/query-core'
|
|
@@ -458,7 +520,7 @@ var QueryClient = class {
|
|
|
458
520
|
}
|
|
459
521
|
/**
|
|
460
522
|
* Returns the query cache this client is connected to.
|
|
461
|
-
*
|
|
523
|
+
* @returns The {@link QueryCache} instance.
|
|
462
524
|
* @example
|
|
463
525
|
* ```ts
|
|
464
526
|
* import { QueryClient } from '@tanstack/query-core'
|
|
@@ -473,7 +535,7 @@ var QueryClient = class {
|
|
|
473
535
|
}
|
|
474
536
|
/**
|
|
475
537
|
* Returns the mutation cache this client is connected to.
|
|
476
|
-
*
|
|
538
|
+
* @returns The {@link MutationCache} instance.
|
|
477
539
|
* @example
|
|
478
540
|
* ```ts
|
|
479
541
|
* import { QueryClient } from '@tanstack/query-core'
|
|
@@ -489,7 +551,7 @@ var QueryClient = class {
|
|
|
489
551
|
/**
|
|
490
552
|
* Returns the default options that were set when creating the client, or via
|
|
491
553
|
* {@link QueryClient#setDefaultOptions}.
|
|
492
|
-
*
|
|
554
|
+
* @returns The client's current default options.
|
|
493
555
|
* @example
|
|
494
556
|
* ```ts
|
|
495
557
|
* import { QueryClient } from '@tanstack/query-core'
|
|
@@ -504,7 +566,7 @@ var QueryClient = class {
|
|
|
504
566
|
/**
|
|
505
567
|
* Dynamically sets the default options for this client, overwriting any previously defined
|
|
506
568
|
* default options.
|
|
507
|
-
*
|
|
569
|
+
* @param options - The new default options for queries and mutations.
|
|
508
570
|
* @see {@link QueryClient#getDefaultOptions}
|
|
509
571
|
* @example
|
|
510
572
|
* ```ts
|
|
@@ -528,7 +590,8 @@ var QueryClient = class {
|
|
|
528
590
|
* registration order by {@link QueryClient#getQueryDefaults}, so register defaults from the
|
|
529
591
|
* most generic key to the least generic one — more specific defaults should be registered
|
|
530
592
|
* after more generic ones so they take precedence.
|
|
531
|
-
*
|
|
593
|
+
* @param queryKey - The query key that query keys are partially matched against.
|
|
594
|
+
* @param options - The default options applied to matching queries.
|
|
532
595
|
* @example
|
|
533
596
|
* ```ts
|
|
534
597
|
* queryClient.setQueryDefaults(['posts'], { queryFn: fetchPosts })
|
|
@@ -546,7 +609,9 @@ var QueryClient = class {
|
|
|
546
609
|
* Returns the default options registered for queries whose query key partially matches the
|
|
547
610
|
* given `queryKey`, via {@link QueryClient#setQueryDefaults}. If multiple registered defaults
|
|
548
611
|
* match, they are merged together in registration order.
|
|
549
|
-
*
|
|
612
|
+
* @param queryKey - The query key to look up registered defaults for.
|
|
613
|
+
* @returns The merged default options of every registration that matches, or an empty object if
|
|
614
|
+
* none match.
|
|
550
615
|
* @example
|
|
551
616
|
* ```ts
|
|
552
617
|
* const defaultOptions = queryClient.getQueryDefaults(['posts'])
|
|
@@ -564,7 +629,8 @@ var QueryClient = class {
|
|
|
564
629
|
* Sets default options for mutations whose mutation key partially matches the given
|
|
565
630
|
* `mutationKey`. As with {@link QueryClient#setQueryDefaults}, the order of registration
|
|
566
631
|
* matters when several registered defaults match the same mutation key.
|
|
567
|
-
*
|
|
632
|
+
* @param mutationKey - The mutation key that mutation keys are partially matched against.
|
|
633
|
+
* @param options - The default options applied to matching mutations.
|
|
568
634
|
* @see {@link QueryClient#getMutationDefaults}
|
|
569
635
|
* @example
|
|
570
636
|
* ```ts
|
|
@@ -581,7 +647,9 @@ var QueryClient = class {
|
|
|
581
647
|
* Returns the default options registered for mutations whose mutation key partially matches
|
|
582
648
|
* the given `mutationKey`, via {@link QueryClient#setMutationDefaults}. If multiple registered
|
|
583
649
|
* defaults match, they are merged together in registration order.
|
|
584
|
-
*
|
|
650
|
+
* @param mutationKey - The mutation key to look up registered defaults for.
|
|
651
|
+
* @returns The merged default options of every registration that matches, or an empty object if
|
|
652
|
+
* none match.
|
|
585
653
|
* @example
|
|
586
654
|
* ```ts
|
|
587
655
|
* const defaultOptions = queryClient.getMutationDefaults(['addPost'])
|
|
@@ -597,9 +665,12 @@ var QueryClient = class {
|
|
|
597
665
|
}
|
|
598
666
|
/**
|
|
599
667
|
* Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the
|
|
600
|
-
* caller into their final, defaulted form: merging `
|
|
601
|
-
*
|
|
602
|
-
*
|
|
668
|
+
* caller into their final, defaulted form: merging the client's own `defaultOptions.queries`,
|
|
669
|
+
* then `queryClient.setQueryDefaults` for the given `queryKey`, then the caller's options on
|
|
670
|
+
* top. A no-op if the options are already defaulted (`_defaulted: true`).
|
|
671
|
+
* @param options - The query options passed by the caller.
|
|
672
|
+
* @returns The defaulted options, with `queryHash` and dependent defaults (e.g.
|
|
673
|
+
* `refetchOnReconnect`) filled in.
|
|
603
674
|
*/
|
|
604
675
|
defaultQueryOptions(options) {
|
|
605
676
|
if (options._defaulted) return options;
|
|
@@ -618,9 +689,11 @@ var QueryClient = class {
|
|
|
618
689
|
}
|
|
619
690
|
/**
|
|
620
691
|
* The mutation counterpart of {@link QueryClient#defaultQueryOptions}. Called by framework
|
|
621
|
-
* adapters (e.g. inside `useMutation`) to merge `
|
|
622
|
-
*
|
|
623
|
-
*
|
|
692
|
+
* adapters (e.g. inside `useMutation`) to merge the client's `defaultOptions.mutations`, then
|
|
693
|
+
* `queryClient.setMutationDefaults` for the given `mutationKey`, then the caller's options on
|
|
694
|
+
* top. A no-op if the options are already defaulted (`_defaulted: true`).
|
|
695
|
+
* @param options - The mutation options passed by the caller.
|
|
696
|
+
* @returns The defaulted options.
|
|
624
697
|
*/
|
|
625
698
|
defaultMutationOptions(options) {
|
|
626
699
|
if (options?._defaulted) return options;
|
|
@@ -633,7 +706,6 @@ var QueryClient = class {
|
|
|
633
706
|
}
|
|
634
707
|
/**
|
|
635
708
|
* Clears both the query cache and the mutation cache this client is connected to.
|
|
636
|
-
*
|
|
637
709
|
* @example
|
|
638
710
|
* ```ts
|
|
639
711
|
* import { QueryClient } from '@tanstack/query-core'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryClient.js","names":[],"sources":["../../src/queryClient.ts"],"sourcesContent":["import {\n functionalUpdate,\n hashKey,\n hashQueryKeyByOptions,\n noop,\n partialMatchKey,\n resolveQueryValue,\n skipToken,\n} from './utils'\nimport { QueryCache } from './queryCache'\nimport { MutationCache } from './mutationCache'\nimport { focusManager } from './focusManager'\nimport { onlineManager } from './onlineManager'\nimport { notifyManager } from './notifyManager'\nimport type {\n CancelOptions,\n DefaultError,\n DefaultOptions,\n DefaultedQueryObserverOptions,\n EnsureInfiniteQueryDataOptions,\n EnsureQueryDataOptions,\n FetchInfiniteQueryOptions,\n FetchQueryOptions,\n InferDataFromTag,\n InferErrorFromTag,\n InfiniteData,\n InfiniteQueryExecuteOptions,\n InvalidateOptions,\n InvalidateQueryFilters,\n MutationKey,\n MutationObserverOptions,\n MutationOptions,\n OmitKeyof,\n QueryClientConfig,\n QueryExecuteOptions,\n QueryKey,\n QueryObserverOptions,\n QueryOptions,\n RefetchOptions,\n RefetchQueryFilters,\n ResetOptions,\n SetDataOptions,\n} from './types'\nimport type { QueryState } from './query'\nimport type { MutationFilters, QueryFilters, Updater } from './utils'\n\n// TYPES\n\ninterface QueryDefaults {\n queryKey: QueryKey\n defaultOptions: OmitKeyof<QueryOptions<any, any, any>, 'queryKey'>\n}\n\ninterface MutationDefaults {\n mutationKey: MutationKey\n defaultOptions: MutationOptions<any, any, any, any>\n}\n\n// CLASS\n\n/**\n * `QueryClient` is used to interact with a cache of queries and mutations. It owns a\n * `QueryCache` and a `MutationCache` (creating default ones if none are passed in) and holds\n * the default options that are applied to queries and mutations created through it.\n *\n * @example\n * ```ts\n * const queryClient = new QueryClient({\n * defaultOptions: {\n * queries: {\n * staleTime: Infinity,\n * },\n * },\n * })\n *\n * await queryClient.query({ queryKey: ['posts'], queryFn: fetchPosts })\n * ```\n */\nexport class QueryClient {\n #queryCache: QueryCache\n #mutationCache: MutationCache\n #defaultOptions: DefaultOptions\n #queryDefaults: Map<string, QueryDefaults>\n #mutationDefaults: Map<string, MutationDefaults>\n #mountCount: number\n #unsubscribeFocus?: () => void\n #unsubscribeOnline?: () => void\n\n constructor(config: QueryClientConfig = {}) {\n this.#queryCache = config.queryCache || new QueryCache()\n this.#mutationCache = config.mutationCache || new MutationCache()\n this.#defaultOptions = config.defaultOptions || {}\n this.#queryDefaults = new Map()\n this.#mutationDefaults = new Map()\n this.#mountCount = 0\n }\n\n /**\n * Called by a framework adapter's `QueryClientProvider`-equivalent when it mounts, to start\n * listening for focus/online events and resume paused mutations. Ref-counted via an internal\n * mount count, so nested or multiple providers sharing the same `QueryClient` don't tear down\n * the shared listeners until the last one unmounts.\n */\n mount(): void {\n this.#mountCount++\n if (this.#mountCount !== 1) return\n\n this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {\n if (focused) {\n await this.resumePausedMutations()\n this.#queryCache.onFocus()\n }\n })\n this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {\n if (online) {\n await this.resumePausedMutations()\n this.#queryCache.onOnline()\n }\n })\n }\n\n /**\n * The inverse of {@link QueryClient#mount} — called by a framework adapter's\n * `QueryClientProvider`-equivalent when it unmounts. Only tears down the focus/online\n * listeners once the mount count returns to `0`.\n */\n unmount(): void {\n this.#mountCount--\n if (this.#mountCount !== 0) return\n\n this.#unsubscribeFocus?.()\n this.#unsubscribeFocus = undefined\n\n this.#unsubscribeOnline?.()\n this.#unsubscribeOnline = undefined\n }\n\n /**\n * Returns the number of queries in the cache that are currently fetching, optionally\n * matching a set of filters. This includes background-fetching, loading new pages, and\n * loading more infinite query results.\n *\n * @example\n * ```ts\n * if (queryClient.isFetching()) {\n * console.log('At least one query is fetching!')\n * }\n * ```\n */\n isFetching<TQueryFilters extends QueryFilters<any> = QueryFilters>(\n filters?: TQueryFilters,\n ): number {\n return this.#queryCache.findAll({ ...filters, fetchStatus: 'fetching' })\n .length\n }\n\n /**\n * Returns the number of mutations in the cache that are currently pending, optionally\n * matching a set of filters.\n *\n * @example\n * ```ts\n * if (queryClient.isMutating()) {\n * console.log('At least one mutation is pending!')\n * }\n * ```\n */\n isMutating<\n TMutationFilters extends MutationFilters<any, any> = MutationFilters,\n >(filters?: TMutationFilters): number {\n return this.#mutationCache.findAll({ ...filters, status: 'pending' }).length\n }\n\n /**\n * Imperative (non-reactive) way to retrieve data for a QueryKey.\n * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.\n *\n * Hint: Do not use this function inside a component, because it won't receive updates.\n * Use `useQuery` to create a `QueryObserver` that subscribes to changes.\n *\n * @returns The cached data for the query, or `undefined` if no query with this key has been observed yet.\n * @see {@link QueryClient#getQueriesData}\n */\n getQueryData<\n TQueryFnData = unknown,\n TTaggedQueryKey extends QueryKey = QueryKey,\n TInferredQueryFnData = InferDataFromTag<TQueryFnData, TTaggedQueryKey>,\n >(queryKey: TTaggedQueryKey): TInferredQueryFnData | undefined {\n const options = this.defaultQueryOptions({ queryKey })\n\n return this.#queryCache.get<TInferredQueryFnData>(options.queryHash)?.state\n .data\n }\n\n /**\n * @deprecated Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.\n */\n ensureQueryData<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n >(\n options: EnsureQueryDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n ): Promise<TData> {\n const defaultedOptions = this.defaultQueryOptions(options)\n const query = this.#queryCache.build(this, defaultedOptions)\n const cachedData = query.state.data\n\n if (cachedData === undefined) {\n // eslint-disable-next-line no-restricted-syntax\n return this.fetchQuery(options)\n }\n\n if (\n options.revalidateIfStale &&\n query.isStaleByTime(resolveQueryValue(defaultedOptions.staleTime, query))\n ) {\n // eslint-disable-next-line no-restricted-syntax\n void this.prefetchQuery(defaultedOptions)\n }\n\n return Promise.resolve(cachedData)\n }\n\n /**\n * Imperative (non-reactive) way to retrieve the cached data of multiple queries at once.\n * Only queries matching the given filters are returned; if none match, an empty array is\n * returned.\n *\n * Because the matched queries can hold data of different shapes (e.g. a broad filter can match\n * queries with unrelated data types), the `TQueryFnData` generic defaults to `unknown` rather\n * than being inferred. Passing a more specific type is a convenience for call sites that know\n * every matched query holds the same shape — it is not checked against the actual cache\n * contents.\n *\n * @returns An array of query key and data pairs. The data is `undefined` for a query with no cached data.\n * @see {@link QueryClient#getQueryData}\n * @example\n * ```ts\n * const data = queryClient.getQueriesData({ queryKey: ['posts'] })\n * ```\n */\n getQueriesData<\n TQueryFnData = unknown,\n TQueryFilters extends QueryFilters<any> = QueryFilters,\n >(filters: TQueryFilters): Array<[QueryKey, TQueryFnData | undefined]> {\n return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {\n const data = state.data as TQueryFnData | undefined\n return [queryKey, data]\n })\n }\n\n /**\n * Synchronous way to immediately update a query's cached data. If the updater (or the value\n * passed) resolves to `undefined`, the cache is left untouched and no query is created;\n * otherwise, if the query does not exist yet, it will be created. To update multiple queries\n * at once by partially matching query keys, use {@link QueryClient#setQueriesData} instead.\n *\n * Updates must be performed immutably: do not mutate `oldData`, or data previously retrieved\n * via {@link QueryClient#getQueryData}, in place.\n *\n * @param queryKey - The query key to set data for.\n * @param updater - Either the new data, or a function that receives the current data (which\n * may be `undefined`) and returns the new data.\n * @param options - Set `updatedAt` to override the timestamp the written data is recorded with.\n * @returns The data that was written, or `undefined` if the updater returned `undefined` — in that case\n * the write is skipped and the cache is left unchanged.\n *\n * @example\n * ```ts\n * queryClient.setQueryData(['posts'], newPosts)\n *\n * // Or, using an updater function that receives the current data:\n * queryClient.setQueryData(['posts'], (oldPosts) => [...oldPosts, newPost])\n * ```\n */\n setQueryData<\n TQueryFnData = unknown,\n TTaggedQueryKey extends QueryKey = QueryKey,\n TInferredQueryFnData = InferDataFromTag<TQueryFnData, TTaggedQueryKey>,\n >(\n queryKey: TTaggedQueryKey,\n updater: Updater<\n NoInfer<TInferredQueryFnData> | undefined,\n NoInfer<TInferredQueryFnData> | undefined\n >,\n options?: SetDataOptions,\n ): NoInfer<TInferredQueryFnData> | undefined {\n const defaultedOptions = this.defaultQueryOptions<\n any,\n any,\n unknown,\n any,\n QueryKey\n >({ queryKey })\n\n const query = this.#queryCache.get<TInferredQueryFnData>(\n defaultedOptions.queryHash,\n )\n const prevData = query?.state.data\n const data = functionalUpdate(updater, prevData)\n\n if (data === undefined) {\n return undefined\n }\n\n return this.#queryCache\n .build(this, defaultedOptions)\n .setData(data, { ...options, manual: true })\n }\n\n /**\n * Synchronous way to immediately update the cached data of multiple queries at once, using\n * filters or partial query key matching. Only queries that already exist and match the given\n * filters are updated; no new cache entries are created. Internally this calls\n * {@link QueryClient#setQueryData} for each matching query.\n *\n * @returns One `[queryKey, data]` tuple per matched query, in the same shape and with the same\n * `undefined` case as {@link QueryClient#setQueryData}.\n * @example\n * ```ts\n * queryClient.setQueriesData({ queryKey: ['posts'] }, (oldPosts) =>\n * oldPosts ? oldPosts.filter((post) => post.id !== deletedId) : oldPosts,\n * )\n * ```\n */\n setQueriesData<\n TQueryFnData,\n TQueryFilters extends QueryFilters<any> = QueryFilters,\n >(\n filters: TQueryFilters,\n updater: Updater<\n NoInfer<TQueryFnData> | undefined,\n NoInfer<TQueryFnData> | undefined\n >,\n options?: SetDataOptions,\n ): Array<[QueryKey, TQueryFnData | undefined]> {\n return notifyManager.batch(() =>\n this.#queryCache\n .findAll(filters)\n .map(({ queryKey }) => [\n queryKey,\n this.setQueryData<TQueryFnData>(queryKey, updater, options),\n ]),\n )\n }\n\n /**\n * Imperative (non-reactive) way to retrieve an existing query's state. If the query does not\n * exist, `undefined` is returned.\n *\n * @example\n * ```ts\n * const state = queryClient.getQueryState(['posts'])\n * console.log(state?.dataUpdatedAt)\n * ```\n */\n getQueryState<\n TQueryFnData = unknown,\n TError = DefaultError,\n TTaggedQueryKey extends QueryKey = QueryKey,\n TInferredQueryFnData = InferDataFromTag<TQueryFnData, TTaggedQueryKey>,\n TInferredError = InferErrorFromTag<TError, TTaggedQueryKey>,\n >(\n queryKey: TTaggedQueryKey,\n ): QueryState<TInferredQueryFnData, TInferredError> | undefined {\n const options = this.defaultQueryOptions({ queryKey })\n return this.#queryCache.get<TInferredQueryFnData, TInferredError>(\n options.queryHash,\n )?.state\n }\n\n /**\n * Removes queries from the cache that match the given filters. Unlike\n * {@link QueryClient#invalidateQueries} or {@link QueryClient#refetchQueries}, this removes\n * matching queries from the cache instead of refetching them. Without filters, every query in\n * the cache is removed.\n *\n * @example\n * ```ts\n * queryClient.removeQueries({ queryKey: ['posts'], exact: true })\n * ```\n */\n removeQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: QueryFilters<TTaggedQueryKey>,\n ): void {\n const queryCache = this.#queryCache\n notifyManager.batch(() => {\n queryCache.findAll(filters).forEach((query) => {\n queryCache.remove(query)\n })\n })\n }\n\n /**\n * Resets queries matching the given filters back to their initial state (e.g. any\n * `initialData`), notifying subscribers rather than removing them. Active queries among the\n * matched set are then refetched, and the returned promise resolves once that refetch settles.\n *\n * @example\n * ```ts\n * await queryClient.resetQueries({ queryKey: ['posts'], exact: true })\n * ```\n */\n resetQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: QueryFilters<TTaggedQueryKey>,\n options?: ResetOptions,\n ): Promise<void> {\n const queryCache = this.#queryCache\n\n return notifyManager.batch(() => {\n const matched = queryCache.findAll(filters)\n const queriesToRefetch = new Set(matched)\n matched.forEach((query) => {\n query.reset()\n })\n return this.refetchQueries(\n {\n type: 'active',\n predicate: (query) => queriesToRefetch.has(query),\n },\n options,\n )\n })\n }\n\n /**\n * Cancels outgoing fetches for queries matching the given filters. Most useful when performing\n * optimistic updates, since any outgoing refetch that resolves afterwards would otherwise\n * overwrite the optimistic update. By default (`revert: true`), a cancelled query's data is\n * reverted to its state before the outgoing fetch started.\n *\n * The returned promise never rejects, even if individual cancellations fail.\n *\n * @example\n * ```ts\n * await queryClient.cancelQueries({ queryKey: ['posts'], exact: true })\n * ```\n */\n cancelQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: QueryFilters<TTaggedQueryKey>,\n cancelOptions: CancelOptions = {},\n ): Promise<void> {\n const defaultedCancelOptions = { revert: true, ...cancelOptions }\n\n const promises = notifyManager.batch(() =>\n this.#queryCache\n .findAll(filters)\n .map((query) => query.cancel(defaultedCancelOptions)),\n )\n\n return Promise.all(promises).then(noop).catch(noop)\n }\n\n /**\n * Marks queries matching the given filters as invalidated. Unlike\n * {@link QueryClient#removeQueries}, invalidated queries stay in the cache.\n *\n * Unless `filters.refetchType` is `'none'`, matching queries are then refetched via\n * {@link QueryClient#refetchQueries}, using `filters.refetchType` if set, otherwise\n * `filters.type`, otherwise `'active'`.\n *\n * @example\n * ```ts\n * await queryClient.invalidateQueries({ queryKey: ['posts'], refetchType: 'active' })\n * ```\n */\n invalidateQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: InvalidateQueryFilters<TTaggedQueryKey>,\n options: InvalidateOptions = {},\n ): Promise<void> {\n return notifyManager.batch(() => {\n this.#queryCache.findAll(filters).forEach((query) => {\n query.invalidate()\n })\n\n if (filters?.refetchType === 'none') {\n return Promise.resolve()\n }\n return this.refetchQueries(\n {\n ...filters,\n type: filters?.refetchType ?? filters?.type ?? 'active',\n },\n options,\n )\n })\n }\n\n /**\n * Refetches queries matching the given filters, regardless of whether they are stale. Without\n * filters, every query in the cache is refetched. Queries that are disabled, or static (only\n * have observers with a static `staleTime`), are never refetched.\n *\n * By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new\n * one starts. The returned promise resolves once all matching queries have settled; it does\n * not reject on individual query failures unless `throwOnError` is set.\n *\n * @example\n * ```ts\n * // refetch all active queries partially matching a query key:\n * await queryClient.refetchQueries({ queryKey: ['posts'], type: 'active' })\n * ```\n */\n refetchQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: RefetchQueryFilters<TTaggedQueryKey>,\n options: RefetchOptions = {},\n ): Promise<void> {\n const fetchOptions = {\n ...options,\n cancelRefetch: options.cancelRefetch ?? true,\n }\n const promises = notifyManager.batch(() =>\n this.#queryCache\n .findAll(filters)\n .filter((query) => !query.isDisabled() && !query.isStatic())\n .map((query) => {\n let promise = query.fetch(undefined, fetchOptions)\n if (!fetchOptions.throwOnError) {\n promise = promise.catch(noop)\n }\n return query.state.fetchStatus === 'paused'\n ? Promise.resolve()\n : promise\n }),\n )\n\n return Promise.all(promises).then(noop)\n }\n\n /**\n * Asynchronous method to fetch and cache a query, resolving with the data or throwing with\n * the error.\n *\n * If the query already exists in the cache and its data is not stale (per the given\n * `staleTime`), the cached data is returned without fetching. Otherwise, the query is fetched\n * and the promise resolves once the fetch settles. If a `select` function is provided, it is\n * applied to the data in both cases (cached or freshly fetched) before it is returned.\n *\n * Unlike a reactive observer, retries are disabled by default here (`retry: false`) unless\n * explicitly configured, since there is no component to catch a thrown error and retry through\n * re-render.\n *\n * The accepted options are `QueryObserverOptions` minus the fields that only make sense for a\n * reactive observer — `enabled`, `refetchInterval`, `refetchIntervalInBackground`,\n * `refetchOnWindowFocus`, `refetchOnReconnect`, `refetchOnMount`, `retryOnMount`,\n * `notifyOnChangeProps`, `throwOnError`, `suspense`, and `placeholderData` are not part of this\n * method's options.\n *\n * This method replaces the deprecated `fetchQuery`, and — combined with\n * `{ staleTime: 'static' }` — the deprecated `ensureQueryData`.\n *\n * @example\n * ```ts\n * try {\n * const data = await queryClient.query({ queryKey, queryFn, staleTime: 10000 })\n * } catch (error) {\n * console.log(error)\n * }\n * ```\n */\n async query<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n >(\n options: QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<TData> {\n const defaultedOptions = this.defaultQueryOptions(options)\n\n // https://github.com/tannerlinsley/react-query/issues/652\n if (defaultedOptions.retry === undefined) {\n defaultedOptions.retry = false\n }\n\n const query = this.#queryCache.build(this, defaultedOptions)\n\n const isStale = query.isStaleByTime(\n resolveQueryValue(defaultedOptions.staleTime, query),\n )\n\n const queryData = isStale\n ? await query.fetch(defaultedOptions)\n : (query.state.data as TQueryData)\n\n const select = defaultedOptions.select\n\n if (select) {\n return select(queryData)\n }\n\n return queryData as unknown as TData\n }\n\n /**\n * @deprecated Use queryClient.query(options) instead. This method will be removed in the next major version.\n */\n fetchQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n >(\n options: FetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<TData> {\n const defaultedOptions = this.defaultQueryOptions(options)\n\n // https://github.com/tannerlinsley/react-query/issues/652\n if (defaultedOptions.retry === undefined) {\n defaultedOptions.retry = false\n }\n\n const query = this.#queryCache.build(this, defaultedOptions)\n\n return query.isStaleByTime(\n resolveQueryValue(defaultedOptions.staleTime, query),\n )\n ? query.fetch(defaultedOptions)\n : Promise.resolve(query.state.data as TData)\n }\n\n /**\n * @deprecated Use queryClient.query(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.\n */\n prefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n >(\n options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n ): Promise<void> {\n // eslint-disable-next-line no-restricted-syntax\n return this.fetchQuery(options).then(noop).catch(noop)\n }\n\n /**\n * Asynchronous method to fetch and cache an infinite query, resolving with an\n * {@link InfiniteData} object or throwing with the error.\n *\n * Behaves like {@link QueryClient#query}, accepting the same options (minus\n * `initialPageParam`), plus the required `initialPageParam`, and an optional `pages` /\n * `getNextPageParam` pair used to refetch a fixed number of pages from the start.\n *\n * This method replaces the deprecated `fetchInfiniteQuery`, and — combined with\n * `{ staleTime: 'static' }` — the deprecated `ensureInfiniteQueryData`.\n *\n * @example\n * ```ts\n * try {\n * const data = await queryClient.infiniteQuery({ queryKey, queryFn, initialPageParam: 0 })\n * console.log(data.pages)\n * } catch (error) {\n * console.log(error)\n * }\n * ```\n */\n infiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n >(\n options: InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<\n Array<TData> extends Array<InfiniteData<TQueryFnData>>\n ? InfiniteData<TQueryFnData, TPageParam>\n : TData\n > {\n options._type = 'infinite'\n return this.query(options as any)\n }\n\n /**\n * @deprecated Use queryClient.infiniteQuery(options) instead. This method will be removed in the next major version.\n */\n fetchInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n >(\n options: FetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<InfiniteData<TData, TPageParam>> {\n options._type = 'infinite'\n // eslint-disable-next-line no-restricted-syntax\n return this.fetchQuery(options as any)\n }\n\n /**\n * @deprecated Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.\n */\n prefetchInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n >(\n options: FetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<void> {\n // eslint-disable-next-line no-restricted-syntax\n return this.fetchInfiniteQuery(options).then(noop).catch(noop)\n }\n\n /**\n * @deprecated Use queryClient.infiniteQuery({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.\n */\n ensureInfiniteQueryData<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n >(\n options: EnsureInfiniteQueryDataOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<InfiniteData<TData, TPageParam>> {\n options._type = 'infinite'\n\n // eslint-disable-next-line no-restricted-syntax\n return this.ensureQueryData(options as any)\n }\n\n /**\n * Resumes mutations that were paused because there was no network connection. Does nothing\n * (resolving immediately) if the client is currently offline.\n *\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * await queryClient.resumePausedMutations()\n * ```\n */\n resumePausedMutations(): Promise<unknown> {\n if (onlineManager.isOnline()) {\n return this.#mutationCache.resumePausedMutations()\n }\n return Promise.resolve()\n }\n\n /**\n * Returns the query cache this client is connected to.\n *\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * const queryCache = queryClient.getQueryCache()\n * const queries = queryCache.findAll({ queryKey: ['posts'] })\n * ```\n */\n getQueryCache(): QueryCache {\n return this.#queryCache\n }\n\n /**\n * Returns the mutation cache this client is connected to.\n *\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * const mutationCache = queryClient.getMutationCache()\n * const mutations = mutationCache.findAll({ status: 'pending' })\n * ```\n */\n getMutationCache(): MutationCache {\n return this.#mutationCache\n }\n\n /**\n * Returns the default options that were set when creating the client, or via\n * {@link QueryClient#setDefaultOptions}.\n *\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * const defaultOptions = queryClient.getDefaultOptions()\n * ```\n */\n getDefaultOptions(): DefaultOptions {\n return this.#defaultOptions\n }\n\n /**\n * Dynamically sets the default options for this client, overwriting any previously defined\n * default options.\n *\n * @see {@link QueryClient#getDefaultOptions}\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * queryClient.setDefaultOptions({\n * queries: {\n * staleTime: Infinity,\n * },\n * })\n * ```\n */\n setDefaultOptions(options: DefaultOptions): void {\n this.#defaultOptions = options\n }\n\n /**\n * Sets default options for queries whose query key partially matches the given `queryKey`.\n *\n * If several registered query defaults match a given query key, they are merged together in\n * registration order by {@link QueryClient#getQueryDefaults}, so register defaults from the\n * most generic key to the least generic one — more specific defaults should be registered\n * after more generic ones so they take precedence.\n *\n * @example\n * ```ts\n * queryClient.setQueryDefaults(['posts'], { queryFn: fetchPosts })\n *\n * await queryClient.query({ queryKey: ['posts'] })\n * ```\n */\n setQueryDefaults<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n >(\n queryKey: QueryKey,\n options: Partial<\n OmitKeyof<\n QueryObserverOptions<TQueryFnData, TError, TData, TQueryData>,\n 'queryKey'\n >\n >,\n ): void {\n this.#queryDefaults.set(hashKey(queryKey), {\n queryKey,\n defaultOptions: options,\n })\n }\n\n /**\n * Returns the default options registered for queries whose query key partially matches the\n * given `queryKey`, via {@link QueryClient#setQueryDefaults}. If multiple registered defaults\n * match, they are merged together in registration order.\n *\n * @example\n * ```ts\n * const defaultOptions = queryClient.getQueryDefaults(['posts'])\n * ```\n */\n getQueryDefaults(\n queryKey: QueryKey,\n ): OmitKeyof<QueryObserverOptions<any, any, any, any, any>, 'queryKey'> {\n const defaults = [...this.#queryDefaults.values()]\n\n const result: OmitKeyof<\n QueryObserverOptions<any, any, any, any, any>,\n 'queryKey'\n > = {}\n\n defaults.forEach((queryDefault) => {\n if (partialMatchKey(queryKey, queryDefault.queryKey)) {\n Object.assign(result, queryDefault.defaultOptions)\n }\n })\n return result\n }\n\n /**\n * Sets default options for mutations whose mutation key partially matches the given\n * `mutationKey`. As with {@link QueryClient#setQueryDefaults}, the order of registration\n * matters when several registered defaults match the same mutation key.\n *\n * @see {@link QueryClient#getMutationDefaults}\n * @example\n * ```ts\n * queryClient.setMutationDefaults(['addPost'], { mutationFn: addPost })\n * ```\n */\n setMutationDefaults<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n >(\n mutationKey: MutationKey,\n options: OmitKeyof<\n MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n ): void {\n this.#mutationDefaults.set(hashKey(mutationKey), {\n mutationKey,\n defaultOptions: options,\n })\n }\n\n /**\n * Returns the default options registered for mutations whose mutation key partially matches\n * the given `mutationKey`, via {@link QueryClient#setMutationDefaults}. If multiple registered\n * defaults match, they are merged together in registration order.\n *\n * @example\n * ```ts\n * const defaultOptions = queryClient.getMutationDefaults(['addPost'])\n * ```\n */\n getMutationDefaults(\n mutationKey: MutationKey,\n ): OmitKeyof<MutationObserverOptions<any, any, any, any>, 'mutationKey'> {\n const defaults = [...this.#mutationDefaults.values()]\n\n const result: OmitKeyof<\n MutationObserverOptions<any, any, any, any>,\n 'mutationKey'\n > = {}\n\n defaults.forEach((queryDefault) => {\n if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {\n Object.assign(result, queryDefault.defaultOptions)\n }\n })\n\n return result\n }\n\n /**\n * Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the\n * caller into their final, defaulted form: merging `queryClient.setQueryDefaults` for the\n * given `queryKey`, then the client's own `defaultOptions.queries`, then the caller's options\n * on top. A no-op if the options are already defaulted (`_defaulted: true`).\n */\n defaultQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n >(\n options:\n | QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >\n | DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n ): DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n > {\n if (options._defaulted) {\n return options as DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n }\n\n const defaultedOptions = {\n ...this.#defaultOptions.queries,\n ...this.getQueryDefaults(options.queryKey),\n ...options,\n _defaulted: true,\n }\n\n if (!defaultedOptions.queryHash) {\n defaultedOptions.queryHash = hashQueryKeyByOptions(\n defaultedOptions.queryKey,\n defaultedOptions,\n )\n }\n\n // dependent default values\n if (defaultedOptions.refetchOnReconnect === undefined) {\n defaultedOptions.refetchOnReconnect =\n defaultedOptions.networkMode !== 'always'\n }\n if (defaultedOptions.throwOnError === undefined) {\n defaultedOptions.throwOnError = !!defaultedOptions.suspense\n }\n\n if (!defaultedOptions.networkMode && defaultedOptions.persister) {\n defaultedOptions.networkMode = 'offlineFirst'\n }\n\n if (defaultedOptions.queryFn === skipToken) {\n defaultedOptions.enabled = false\n }\n\n return defaultedOptions as DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n }\n\n /**\n * The mutation counterpart of {@link QueryClient#defaultQueryOptions}. Called by framework\n * adapters (e.g. inside `useMutation`) to merge `queryClient.setMutationDefaults` for the\n * given `mutationKey`, then the client's `defaultOptions.mutations`, then the caller's options\n * on top. A no-op if the options are already defaulted (`_defaulted: true`).\n */\n defaultMutationOptions<T extends MutationOptions<any, any, any, any>>(\n options?: T,\n ): T {\n if (options?._defaulted) {\n return options\n }\n return {\n ...this.#defaultOptions.mutations,\n ...(options?.mutationKey &&\n this.getMutationDefaults(options.mutationKey)),\n ...options,\n _defaulted: true,\n } as T\n }\n\n /**\n * Clears both the query cache and the mutation cache this client is connected to.\n *\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * queryClient.clear()\n * ```\n */\n clear(): void {\n this.#queryCache.clear()\n this.#mutationCache.clear()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,IAAa,cAAb,MAAyB;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAA4B,CAAC,GAAG;EAC1C,KAAK,cAAc,OAAO,cAAc,IAAI,WAAW;EACvD,KAAK,iBAAiB,OAAO,iBAAiB,IAAI,cAAc;EAChE,KAAK,kBAAkB,OAAO,kBAAkB,CAAC;EACjD,KAAK,iCAAiB,IAAI,IAAI;EAC9B,KAAK,oCAAoB,IAAI,IAAI;EACjC,KAAK,cAAc;CACrB;;;;;;;CAQA,QAAc;EACZ,KAAK;EACL,IAAI,KAAK,gBAAgB,GAAG;EA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;EAIF,IAAI,iBAAiB,uBAAuB,KAAA,GAC1C,iBAAiB,qBACf,iBAAiB,gBAAgB;EAErC,IAAI,iBAAiB,iBAAiB,KAAA,GACpC,iBAAiB,eAAe,CAAC,CAAC,iBAAiB;EAGrD,IAAI,CAAC,iBAAiB,eAAe,iBAAiB,WACpD,iBAAiB,cAAc;EAGjC,IAAI,iBAAiB,YAAY,WAC/B,iBAAiB,UAAU;EAG7B,OAAO;CAOT;;;;;;;CAQA,uBACE,SACG;EACH,IAAI,SAAS,YACX,OAAO;EAET,OAAO;GACL,GAAG,KAAK,gBAAgB;GACxB,GAAI,SAAS,eACX,KAAK,oBAAoB,QAAQ,WAAW;GAC9C,GAAG;GACH,YAAY;EACd;CACF;;;;;;;;;;;;CAaA,QAAc;EACZ,KAAK,YAAY,MAAM;EACvB,KAAK,eAAe,MAAM;CAC5B;AACF"}
|
|
1
|
+
{"version":3,"file":"queryClient.js","names":[],"sources":["../../src/queryClient.ts"],"sourcesContent":["import {\n functionalUpdate,\n hashKey,\n hashQueryKeyByOptions,\n noop,\n partialMatchKey,\n resolveQueryValue,\n skipToken,\n} from './utils'\nimport { QueryCache } from './queryCache'\nimport { MutationCache } from './mutationCache'\nimport { focusManager } from './focusManager'\nimport { onlineManager } from './onlineManager'\nimport { notifyManager } from './notifyManager'\nimport type {\n CancelOptions,\n DefaultError,\n DefaultOptions,\n DefaultedQueryObserverOptions,\n EnsureInfiniteQueryDataOptions,\n EnsureQueryDataOptions,\n FetchInfiniteQueryOptions,\n FetchQueryOptions,\n InferDataFromTag,\n InferErrorFromTag,\n InfiniteData,\n InfiniteQueryExecuteOptions,\n InvalidateOptions,\n InvalidateQueryFilters,\n MutationKey,\n MutationObserverOptions,\n MutationOptions,\n OmitKeyof,\n QueryClientConfig,\n QueryExecuteOptions,\n QueryKey,\n QueryObserverOptions,\n QueryOptions,\n RefetchOptions,\n RefetchQueryFilters,\n ResetOptions,\n SetDataOptions,\n} from './types'\nimport type { QueryState } from './query'\nimport type { MutationFilters, QueryFilters, Updater } from './utils'\n\n// TYPES\n\ninterface QueryDefaults {\n queryKey: QueryKey\n defaultOptions: OmitKeyof<QueryOptions<any, any, any>, 'queryKey'>\n}\n\ninterface MutationDefaults {\n mutationKey: MutationKey\n defaultOptions: MutationOptions<any, any, any, any>\n}\n\n// CLASS\n\n/**\n * `QueryClient` is used to interact with a cache of queries and mutations. It owns a\n * `QueryCache` and a `MutationCache` (creating default ones if none are passed in) and holds\n * the default options that are applied to queries and mutations created through it.\n * @example\n * ```ts\n * const queryClient = new QueryClient({\n * defaultOptions: {\n * queries: {\n * staleTime: Infinity,\n * },\n * },\n * })\n *\n * await queryClient.query({ queryKey: ['posts'], queryFn: fetchPosts })\n * ```\n */\nexport class QueryClient {\n #queryCache: QueryCache\n #mutationCache: MutationCache\n #defaultOptions: DefaultOptions\n #queryDefaults: Map<string, QueryDefaults>\n #mutationDefaults: Map<string, MutationDefaults>\n #mountCount: number\n #unsubscribeFocus?: () => void\n #unsubscribeOnline?: () => void\n\n constructor(config: QueryClientConfig = {}) {\n this.#queryCache = config.queryCache || new QueryCache()\n this.#mutationCache = config.mutationCache || new MutationCache()\n this.#defaultOptions = config.defaultOptions || {}\n this.#queryDefaults = new Map()\n this.#mutationDefaults = new Map()\n this.#mountCount = 0\n }\n\n /**\n * Called by a framework adapter's `QueryClientProvider`-equivalent when it mounts, to start\n * listening for focus/online events and resume paused mutations. Ref-counted via an internal\n * mount count, so nested or multiple providers sharing the same `QueryClient` don't tear down\n * the shared listeners until the last one unmounts.\n */\n mount(): void {\n this.#mountCount++\n if (this.#mountCount !== 1) return\n\n this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {\n if (focused) {\n await this.resumePausedMutations()\n this.#queryCache.onFocus()\n }\n })\n this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {\n if (online) {\n await this.resumePausedMutations()\n this.#queryCache.onOnline()\n }\n })\n }\n\n /**\n * The inverse of {@link QueryClient#mount} — called by a framework adapter's\n * `QueryClientProvider`-equivalent when it unmounts. Only tears down the focus/online\n * listeners once the mount count returns to `0`.\n */\n unmount(): void {\n this.#mountCount--\n if (this.#mountCount !== 0) return\n\n this.#unsubscribeFocus?.()\n this.#unsubscribeFocus = undefined\n\n this.#unsubscribeOnline?.()\n this.#unsubscribeOnline = undefined\n }\n\n /**\n * Returns the number of queries in the cache that are currently fetching, optionally\n * matching a set of filters. This includes background-fetching, loading new pages, and\n * loading more infinite query results.\n * @param filters - Narrows down which fetching queries are counted. Without filters, every\n * fetching query is counted.\n * @returns The number of matching queries whose `fetchStatus` is `'fetching'`.\n * @example\n * ```ts\n * if (queryClient.isFetching()) {\n * console.log('At least one query is fetching!')\n * }\n * ```\n */\n isFetching<TQueryFilters extends QueryFilters<any> = QueryFilters>(\n filters?: TQueryFilters,\n ): number {\n return this.#queryCache.findAll({ ...filters, fetchStatus: 'fetching' })\n .length\n }\n\n /**\n * Returns the number of mutations in the cache that are currently pending, optionally\n * matching a set of filters.\n * @param filters - Narrows down which pending mutations are counted. Without filters, every\n * pending mutation is counted.\n * @returns The number of matching mutations whose `status` is `'pending'`.\n * @example\n * ```ts\n * if (queryClient.isMutating()) {\n * console.log('At least one mutation is pending!')\n * }\n * ```\n */\n isMutating<\n TMutationFilters extends MutationFilters<any, any> = MutationFilters,\n >(filters?: TMutationFilters): number {\n return this.#mutationCache.findAll({ ...filters, status: 'pending' }).length\n }\n\n /**\n * Imperative (non-reactive) way to retrieve data for a QueryKey.\n * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.\n *\n * Hint: Do not use this function inside a component, because it won't receive updates.\n * Use `useQuery` to create a `QueryObserver` that subscribes to changes.\n * @param queryKey - The query key of the query to read.\n * @returns The cached data for the query, or `undefined` if no query with this key has been observed yet.\n * @see {@link QueryClient#getQueriesData}\n */\n getQueryData<\n TQueryFnData = unknown,\n TTaggedQueryKey extends QueryKey = QueryKey,\n TInferredQueryFnData = InferDataFromTag<TQueryFnData, TTaggedQueryKey>,\n >(queryKey: TTaggedQueryKey): TInferredQueryFnData | undefined {\n const options = this.defaultQueryOptions({ queryKey })\n\n return this.#queryCache.get<TInferredQueryFnData>(options.queryHash)?.state\n .data\n }\n\n /**\n * Returns the cached data of a query, or fetches it if there is none. With `revalidateIfStale`,\n * stale cached data is also refetched in the background.\n * @param options - The query options. If the query has no cached data yet, it is fetched with\n * these options.\n * @returns A promise that resolves to the cached data, or to the fetched data if nothing was\n * cached yet.\n * @deprecated Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.\n */\n ensureQueryData<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n >(\n options: EnsureQueryDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n ): Promise<TData> {\n const defaultedOptions = this.defaultQueryOptions(options)\n const query = this.#queryCache.build(this, defaultedOptions)\n const cachedData = query.state.data\n\n if (cachedData === undefined) {\n // oxlint-disable-next-line tanstack-query/no-restricted-syntax\n return this.fetchQuery(options)\n }\n\n if (\n options.revalidateIfStale &&\n query.isStaleByTime(resolveQueryValue(defaultedOptions.staleTime, query))\n ) {\n // oxlint-disable-next-line tanstack-query/no-restricted-syntax\n void this.prefetchQuery(defaultedOptions)\n }\n\n return Promise.resolve(cachedData)\n }\n\n /**\n * Imperative (non-reactive) way to retrieve the cached data of multiple queries at once.\n * Only queries matching the given filters are returned; if none match, an empty array is\n * returned.\n *\n * Because the matched queries can hold data of different shapes (e.g. a broad filter can match\n * queries with unrelated data types), the `TQueryFnData` generic defaults to `unknown` rather\n * than being inferred. Passing a more specific type is a convenience for call sites that know\n * every matched query holds the same shape — it is not checked against the actual cache\n * contents.\n * @param filters - The filters that select which queries to read.\n * @returns An array of query key and data pairs. The data is `undefined` for a query with no cached data.\n * @see {@link QueryClient#getQueryData}\n * @example\n * ```ts\n * const data = queryClient.getQueriesData({ queryKey: ['posts'] })\n * ```\n */\n getQueriesData<\n TQueryFnData = unknown,\n TQueryFilters extends QueryFilters<any> = QueryFilters,\n >(filters: TQueryFilters): Array<[QueryKey, TQueryFnData | undefined]> {\n return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {\n const data = state.data as TQueryFnData | undefined\n return [queryKey, data]\n })\n }\n\n /**\n * Synchronous way to immediately update a query's cached data. If the updater (or the value\n * passed) resolves to `undefined`, the cache is left untouched and no query is created;\n * otherwise, if the query does not exist yet, it will be created. To update multiple queries\n * at once by partially matching query keys, use {@link QueryClient#setQueriesData} instead.\n *\n * Updates must be performed immutably: do not mutate `oldData`, or data previously retrieved\n * via {@link QueryClient#getQueryData}, in place.\n * @param queryKey - The query key to set data for.\n * @param updater - Either the new data, or a function that receives the current data (which\n * may be `undefined`) and returns the new data.\n * @param options - Set `updatedAt` to override the timestamp the written data is recorded with.\n * @returns The data that was written, or `undefined` if the updater returned `undefined` — in that case\n * the write is skipped and the cache is left unchanged.\n * @example\n * ```ts\n * queryClient.setQueryData(['posts'], newPosts)\n *\n * // Or, using an updater function that receives the current data:\n * queryClient.setQueryData(['posts'], (oldPosts) => [...oldPosts, newPost])\n * ```\n */\n setQueryData<\n TQueryFnData = unknown,\n TTaggedQueryKey extends QueryKey = QueryKey,\n TInferredQueryFnData = InferDataFromTag<TQueryFnData, TTaggedQueryKey>,\n >(\n queryKey: TTaggedQueryKey,\n updater: Updater<\n NoInfer<TInferredQueryFnData> | undefined,\n NoInfer<TInferredQueryFnData> | undefined\n >,\n options?: SetDataOptions,\n ): NoInfer<TInferredQueryFnData> | undefined {\n const defaultedOptions = this.defaultQueryOptions<\n any,\n any,\n unknown,\n any,\n QueryKey\n >({ queryKey })\n\n const query = this.#queryCache.get<TInferredQueryFnData>(\n defaultedOptions.queryHash,\n )\n const prevData = query?.state.data\n const data = functionalUpdate(updater, prevData)\n\n if (data === undefined) {\n return undefined\n }\n\n return this.#queryCache\n .build(this, defaultedOptions)\n .setData(data, { ...options, manual: true })\n }\n\n /**\n * Synchronous way to immediately update the cached data of multiple queries at once, using\n * filters or partial query key matching. Only queries that already exist and match the given\n * filters are updated; no new cache entries are created. Internally this calls\n * {@link QueryClient#setQueryData} for each matching query.\n * @param filters - The filters that select which existing queries to update.\n * @param updater - Either the new data, or a function that receives each matched query's current\n * data (which may be `undefined`) and returns the new data.\n * @param options - Set `updatedAt` to override the timestamp the written data is recorded with.\n * @returns One `[queryKey, data]` tuple per matched query, in the same shape and with the same\n * `undefined` case as {@link QueryClient#setQueryData}.\n * @example\n * ```ts\n * queryClient.setQueriesData({ queryKey: ['posts'] }, (oldPosts) =>\n * oldPosts ? oldPosts.filter((post) => post.id !== deletedId) : oldPosts,\n * )\n * ```\n */\n setQueriesData<\n TQueryFnData,\n TQueryFilters extends QueryFilters<any> = QueryFilters,\n >(\n filters: TQueryFilters,\n updater: Updater<\n NoInfer<TQueryFnData> | undefined,\n NoInfer<TQueryFnData> | undefined\n >,\n options?: SetDataOptions,\n ): Array<[QueryKey, TQueryFnData | undefined]> {\n return notifyManager.batch(() =>\n this.#queryCache\n .findAll(filters)\n .map(({ queryKey }) => [\n queryKey,\n this.setQueryData<TQueryFnData>(queryKey, updater, options),\n ]),\n )\n }\n\n /**\n * Imperative (non-reactive) way to retrieve an existing query's state. If the query does not\n * exist, `undefined` is returned.\n * @param queryKey - The query key of the query to read.\n * @returns The query's state, or `undefined` if no query with this key exists.\n * @example\n * ```ts\n * const state = queryClient.getQueryState(['posts'])\n * console.log(state?.dataUpdatedAt)\n * ```\n */\n getQueryState<\n TQueryFnData = unknown,\n TError = DefaultError,\n TTaggedQueryKey extends QueryKey = QueryKey,\n TInferredQueryFnData = InferDataFromTag<TQueryFnData, TTaggedQueryKey>,\n TInferredError = InferErrorFromTag<TError, TTaggedQueryKey>,\n >(\n queryKey: TTaggedQueryKey,\n ): QueryState<TInferredQueryFnData, TInferredError> | undefined {\n const options = this.defaultQueryOptions({ queryKey })\n return this.#queryCache.get<TInferredQueryFnData, TInferredError>(\n options.queryHash,\n )?.state\n }\n\n /**\n * Removes queries from the cache that match the given filters. Unlike\n * {@link QueryClient#invalidateQueries} or {@link QueryClient#refetchQueries}, this removes\n * matching queries from the cache instead of refetching them. Without filters, every query in\n * the cache is removed.\n * @param filters - The filters that select which queries to remove. Without filters, every query\n * is removed.\n * @example\n * ```ts\n * queryClient.removeQueries({ queryKey: ['posts'], exact: true })\n * ```\n */\n removeQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: QueryFilters<TTaggedQueryKey>,\n ): void {\n const queryCache = this.#queryCache\n notifyManager.batch(() => {\n queryCache.findAll(filters).forEach((query) => {\n queryCache.remove(query)\n })\n })\n }\n\n /**\n * Resets queries matching the given filters back to their initial state (e.g. any\n * `initialData`), notifying subscribers rather than removing them. Active queries among the\n * matched set are then refetched, and the returned promise resolves once that refetch settles.\n * @param filters - The filters that select which queries to reset. Without filters, every query\n * is reset.\n * @param options - Passed to the refetch of the active matched queries, e.g. `cancelRefetch` and\n * `throwOnError`.\n * @returns A promise that resolves once the refetch of the active matched queries settles.\n * @example\n * ```ts\n * await queryClient.resetQueries({ queryKey: ['posts'], exact: true })\n * ```\n */\n resetQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: QueryFilters<TTaggedQueryKey>,\n options?: ResetOptions,\n ): Promise<void> {\n const queryCache = this.#queryCache\n\n return notifyManager.batch(() => {\n const matched = queryCache.findAll(filters)\n const queriesToRefetch = new Set(matched)\n matched.forEach((query) => {\n query.reset()\n })\n return this.refetchQueries(\n {\n type: 'active',\n predicate: (query) => queriesToRefetch.has(query),\n },\n options,\n )\n })\n }\n\n /**\n * Cancels outgoing fetches for queries matching the given filters. Most useful when performing\n * optimistic updates, since any outgoing refetch that resolves afterwards would otherwise\n * overwrite the optimistic update. By default (`revert: true`), a cancelled query's data is\n * reverted to its state before the outgoing fetch started.\n *\n * The returned promise never rejects, even if individual cancellations fail.\n * @param filters - The filters that select which queries to cancel. Without filters, every query\n * is cancelled.\n * @param cancelOptions - Passed to each matched query's cancellation. `revert` defaults to\n * `true`.\n * @returns A promise that resolves once every cancellation has settled.\n * @example\n * ```ts\n * await queryClient.cancelQueries({ queryKey: ['posts'], exact: true })\n * ```\n */\n cancelQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: QueryFilters<TTaggedQueryKey>,\n cancelOptions: CancelOptions = {},\n ): Promise<void> {\n const defaultedCancelOptions = { revert: true, ...cancelOptions }\n\n const promises = notifyManager.batch(() =>\n this.#queryCache\n .findAll(filters)\n .map((query) => query.cancel(defaultedCancelOptions)),\n )\n\n return Promise.all(promises).then(noop).catch(noop)\n }\n\n /**\n * Marks queries matching the given filters as invalidated. Unlike\n * {@link QueryClient#removeQueries}, invalidated queries stay in the cache.\n *\n * Unless `filters.refetchType` is `'none'`, matching queries are then refetched via\n * {@link QueryClient#refetchQueries}, using `filters.refetchType` if set, otherwise\n * `filters.type`, otherwise `'active'`.\n * @param filters - The filters that select which queries to invalidate, plus `refetchType` to\n * control which of them to refetch afterwards. Without filters, every query is invalidated.\n * @param options - Passed to {@link QueryClient#refetchQueries}, e.g. `cancelRefetch` and\n * `throwOnError`.\n * @returns A promise that resolves once the refetch settles, or immediately if `refetchType` is\n * `'none'`.\n * @example\n * ```ts\n * await queryClient.invalidateQueries({ queryKey: ['posts'], refetchType: 'active' })\n * ```\n */\n invalidateQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: InvalidateQueryFilters<TTaggedQueryKey>,\n options: InvalidateOptions = {},\n ): Promise<void> {\n return notifyManager.batch(() => {\n this.#queryCache.findAll(filters).forEach((query) => {\n query.invalidate()\n })\n\n if (filters?.refetchType === 'none') {\n return Promise.resolve()\n }\n return this.refetchQueries(\n {\n ...filters,\n type: filters?.refetchType ?? filters?.type ?? 'active',\n },\n options,\n )\n })\n }\n\n /**\n * Refetches queries matching the given filters, regardless of whether they are stale. Without\n * filters, every query in the cache is refetched. Queries that are disabled, or static (only\n * have observers with a static `staleTime`), are never refetched.\n *\n * By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new\n * one starts. The returned promise resolves once all matching queries have settled; it does\n * not reject on individual query failures unless `throwOnError` is set.\n * @param filters - The filters that select which queries to refetch. Without filters, every query\n * in the cache is included.\n * @param options - Set `cancelRefetch` to `false` to keep a running fetch instead of cancelling\n * it, and `throwOnError` to `true` to reject when a refetch fails.\n * @returns A promise that resolves once every matched query has settled.\n * @example\n * ```ts\n * // refetch all active queries partially matching a query key:\n * await queryClient.refetchQueries({ queryKey: ['posts'], type: 'active' })\n * ```\n */\n refetchQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: RefetchQueryFilters<TTaggedQueryKey>,\n options: RefetchOptions = {},\n ): Promise<void> {\n const fetchOptions = {\n ...options,\n cancelRefetch: options.cancelRefetch ?? true,\n }\n const promises = notifyManager.batch(() =>\n this.#queryCache\n .findAll(filters)\n .filter((query) => !query.isDisabled() && !query.isStatic())\n .map((query) => {\n let promise = query.fetch(undefined, fetchOptions)\n if (!fetchOptions.throwOnError) {\n promise = promise.catch(noop)\n }\n return query.state.fetchStatus === 'paused'\n ? Promise.resolve()\n : promise\n }),\n )\n\n return Promise.all(promises).then(noop)\n }\n\n /**\n * Asynchronous method to fetch and cache a query, resolving with the data or throwing with\n * the error.\n *\n * If the query already exists in the cache and its data is not stale (per the given\n * `staleTime`), the cached data is returned without fetching. Otherwise, the query is fetched\n * and the promise resolves once the fetch settles. If a `select` function is provided, it is\n * applied to the data in both cases (cached or freshly fetched) before it is returned.\n *\n * Unlike a reactive observer, retries are disabled by default here (`retry: false`) unless\n * explicitly configured, since there is no component to catch a thrown error and retry through\n * re-render.\n *\n * The accepted options are `QueryObserverOptions` minus the fields that only make sense for a\n * reactive observer — `enabled`, `refetchInterval`, `refetchIntervalInBackground`,\n * `refetchOnWindowFocus`, `refetchOnReconnect`, `refetchOnMount`, `retryOnMount`,\n * `notifyOnChangeProps`, `throwOnError`, `suspense`, and `placeholderData` are not part of this\n * method's options.\n *\n * This method replaces the deprecated `fetchQuery`, and — combined with\n * `{ staleTime: 'static' }` — the deprecated `ensureQueryData`.\n * @param options - The query options, including the `queryKey` and the `queryFn` used if the\n * query needs to fetch.\n * @returns A promise that resolves to the data, or to the result of `select` if provided. It\n * rejects with the error from the fetch or from `select`.\n * @example\n * ```ts\n * try {\n * const data = await queryClient.query({ queryKey, queryFn, staleTime: 10000 })\n * } catch (error) {\n * console.log(error)\n * }\n * ```\n */\n async query<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n >(\n options: QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<TData> {\n const defaultedOptions = this.defaultQueryOptions(options)\n\n // https://github.com/tannerlinsley/react-query/issues/652\n if (defaultedOptions.retry === undefined) {\n defaultedOptions.retry = false\n }\n\n const query = this.#queryCache.build(this, defaultedOptions)\n\n const isStale = query.isStaleByTime(\n resolveQueryValue(defaultedOptions.staleTime, query),\n )\n\n const queryData = isStale\n ? await query.fetch(defaultedOptions)\n : (query.state.data as TQueryData)\n\n const select = defaultedOptions.select\n\n if (select) {\n return select(queryData)\n }\n\n return queryData as unknown as TData\n }\n\n /**\n * Fetches and caches a query, or returns its cached data if it isn't stale. Unlike in observers,\n * the fetch isn't retried unless `retry` is set.\n * @param options - The query options, including the `queryKey` and the `queryFn` used if the\n * query needs to fetch.\n * @returns A promise that resolves to the cached or fetched data, or rejects with the fetch\n * error.\n * @deprecated Use queryClient.query(options) instead. This method will be removed in the next major version.\n */\n fetchQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n >(\n options: FetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<TData> {\n const defaultedOptions = this.defaultQueryOptions(options)\n\n // https://github.com/tannerlinsley/react-query/issues/652\n if (defaultedOptions.retry === undefined) {\n defaultedOptions.retry = false\n }\n\n const query = this.#queryCache.build(this, defaultedOptions)\n\n return query.isStaleByTime(\n resolveQueryValue(defaultedOptions.staleTime, query),\n )\n ? query.fetch(defaultedOptions)\n : Promise.resolve(query.state.data as TData)\n }\n\n /**\n * Fetches and caches a query like {@link QueryClient#fetchQuery}, but ignores the result and any\n * error.\n * @param options - The query options, including the `queryKey` and the `queryFn` used if the\n * query needs to fetch.\n * @returns A promise that resolves once the fetch settles. It never rejects.\n * @deprecated Use queryClient.query(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.\n */\n prefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n >(\n options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n ): Promise<void> {\n // oxlint-disable-next-line tanstack-query/no-restricted-syntax\n return this.fetchQuery(options).then(noop).catch(noop)\n }\n\n /**\n * Asynchronous method to fetch and cache an infinite query, resolving with an\n * {@link InfiniteData} object or throwing with the error.\n *\n * Behaves like {@link QueryClient#query}, accepting the same options (minus\n * `initialPageParam`), plus the required `initialPageParam`, and an optional `pages` /\n * `getNextPageParam` pair used to refetch a fixed number of pages from the start.\n *\n * This method replaces the deprecated `fetchInfiniteQuery`, and — combined with\n * `{ staleTime: 'static' }` — the deprecated `ensureInfiniteQueryData`.\n * @param options - The infinite query options, including the `queryKey`, the `queryFn`, and the\n * `initialPageParam`.\n * @returns A promise that resolves to the {@link InfiniteData}, or to the result of `select` if\n * provided. It rejects with the error from the fetch or from `select`.\n * @example\n * ```ts\n * try {\n * const data = await queryClient.infiniteQuery({ queryKey, queryFn, initialPageParam: 0 })\n * console.log(data.pages)\n * } catch (error) {\n * console.log(error)\n * }\n * ```\n */\n infiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n >(\n options: InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<\n Array<TData> extends Array<InfiniteData<TQueryFnData>>\n ? InfiniteData<TQueryFnData, TPageParam>\n : TData\n > {\n options._type = 'infinite'\n return this.query(options as any)\n }\n\n /**\n * Fetches and caches an infinite query, or returns its cached data if it isn't stale.\n * @param options - The infinite query options, including the `queryKey`, the `queryFn`, and the\n * `initialPageParam`.\n * @returns A promise that resolves to the cached or fetched {@link InfiniteData}, or rejects with\n * the fetch error.\n * @deprecated Use queryClient.infiniteQuery(options) instead. This method will be removed in the next major version.\n */\n fetchInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n >(\n options: FetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<InfiniteData<TData, TPageParam>> {\n options._type = 'infinite'\n // oxlint-disable-next-line tanstack-query/no-restricted-syntax\n return this.fetchQuery(options as any)\n }\n\n /**\n * Fetches and caches an infinite query like {@link QueryClient#fetchInfiniteQuery}, but ignores\n * the result and any error.\n * @param options - The infinite query options, including the `queryKey`, the `queryFn`, and the\n * `initialPageParam`.\n * @returns A promise that resolves once the fetch settles. It never rejects.\n * @deprecated Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.\n */\n prefetchInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n >(\n options: FetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<void> {\n // oxlint-disable-next-line tanstack-query/no-restricted-syntax\n return this.fetchInfiniteQuery(options).then(noop).catch(noop)\n }\n\n /**\n * Returns the cached data of an infinite query, or fetches it if there is none. With\n * `revalidateIfStale`, stale cached data is also refetched in the background.\n * @param options - The infinite query options. If the query has no cached data yet, it is fetched\n * with these options.\n * @returns A promise that resolves to the cached {@link InfiniteData}, or to the fetched data if\n * nothing was cached yet.\n * @deprecated Use queryClient.infiniteQuery({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.\n */\n ensureInfiniteQueryData<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n >(\n options: EnsureInfiniteQueryDataOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<InfiniteData<TData, TPageParam>> {\n options._type = 'infinite'\n\n // oxlint-disable-next-line tanstack-query/no-restricted-syntax\n return this.ensureQueryData(options as any)\n }\n\n /**\n * Resumes mutations that were paused because there was no network connection. Does nothing\n * (resolving immediately) if the client is currently offline.\n * @returns A promise that resolves once the resumed mutations have settled.\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * await queryClient.resumePausedMutations()\n * ```\n */\n resumePausedMutations(): Promise<unknown> {\n if (onlineManager.isOnline()) {\n return this.#mutationCache.resumePausedMutations()\n }\n return Promise.resolve()\n }\n\n /**\n * Returns the query cache this client is connected to.\n * @returns The {@link QueryCache} instance.\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * const queryCache = queryClient.getQueryCache()\n * const queries = queryCache.findAll({ queryKey: ['posts'] })\n * ```\n */\n getQueryCache(): QueryCache {\n return this.#queryCache\n }\n\n /**\n * Returns the mutation cache this client is connected to.\n * @returns The {@link MutationCache} instance.\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * const mutationCache = queryClient.getMutationCache()\n * const mutations = mutationCache.findAll({ status: 'pending' })\n * ```\n */\n getMutationCache(): MutationCache {\n return this.#mutationCache\n }\n\n /**\n * Returns the default options that were set when creating the client, or via\n * {@link QueryClient#setDefaultOptions}.\n * @returns The client's current default options.\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * const defaultOptions = queryClient.getDefaultOptions()\n * ```\n */\n getDefaultOptions(): DefaultOptions {\n return this.#defaultOptions\n }\n\n /**\n * Dynamically sets the default options for this client, overwriting any previously defined\n * default options.\n * @param options - The new default options for queries and mutations.\n * @see {@link QueryClient#getDefaultOptions}\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * queryClient.setDefaultOptions({\n * queries: {\n * staleTime: Infinity,\n * },\n * })\n * ```\n */\n setDefaultOptions(options: DefaultOptions): void {\n this.#defaultOptions = options\n }\n\n /**\n * Sets default options for queries whose query key partially matches the given `queryKey`.\n *\n * If several registered query defaults match a given query key, they are merged together in\n * registration order by {@link QueryClient#getQueryDefaults}, so register defaults from the\n * most generic key to the least generic one — more specific defaults should be registered\n * after more generic ones so they take precedence.\n * @param queryKey - The query key that query keys are partially matched against.\n * @param options - The default options applied to matching queries.\n * @example\n * ```ts\n * queryClient.setQueryDefaults(['posts'], { queryFn: fetchPosts })\n *\n * await queryClient.query({ queryKey: ['posts'] })\n * ```\n */\n setQueryDefaults<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n >(\n queryKey: QueryKey,\n options: Partial<\n OmitKeyof<\n QueryObserverOptions<TQueryFnData, TError, TData, TQueryData>,\n 'queryKey'\n >\n >,\n ): void {\n this.#queryDefaults.set(hashKey(queryKey), {\n queryKey,\n defaultOptions: options,\n })\n }\n\n /**\n * Returns the default options registered for queries whose query key partially matches the\n * given `queryKey`, via {@link QueryClient#setQueryDefaults}. If multiple registered defaults\n * match, they are merged together in registration order.\n * @param queryKey - The query key to look up registered defaults for.\n * @returns The merged default options of every registration that matches, or an empty object if\n * none match.\n * @example\n * ```ts\n * const defaultOptions = queryClient.getQueryDefaults(['posts'])\n * ```\n */\n getQueryDefaults(\n queryKey: QueryKey,\n ): OmitKeyof<QueryObserverOptions<any, any, any, any, any>, 'queryKey'> {\n const defaults = [...this.#queryDefaults.values()]\n\n const result: OmitKeyof<\n QueryObserverOptions<any, any, any, any, any>,\n 'queryKey'\n > = {}\n\n defaults.forEach((queryDefault) => {\n if (partialMatchKey(queryKey, queryDefault.queryKey)) {\n Object.assign(result, queryDefault.defaultOptions)\n }\n })\n return result\n }\n\n /**\n * Sets default options for mutations whose mutation key partially matches the given\n * `mutationKey`. As with {@link QueryClient#setQueryDefaults}, the order of registration\n * matters when several registered defaults match the same mutation key.\n * @param mutationKey - The mutation key that mutation keys are partially matched against.\n * @param options - The default options applied to matching mutations.\n * @see {@link QueryClient#getMutationDefaults}\n * @example\n * ```ts\n * queryClient.setMutationDefaults(['addPost'], { mutationFn: addPost })\n * ```\n */\n setMutationDefaults<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n >(\n mutationKey: MutationKey,\n options: OmitKeyof<\n MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n ): void {\n this.#mutationDefaults.set(hashKey(mutationKey), {\n mutationKey,\n defaultOptions: options,\n })\n }\n\n /**\n * Returns the default options registered for mutations whose mutation key partially matches\n * the given `mutationKey`, via {@link QueryClient#setMutationDefaults}. If multiple registered\n * defaults match, they are merged together in registration order.\n * @param mutationKey - The mutation key to look up registered defaults for.\n * @returns The merged default options of every registration that matches, or an empty object if\n * none match.\n * @example\n * ```ts\n * const defaultOptions = queryClient.getMutationDefaults(['addPost'])\n * ```\n */\n getMutationDefaults(\n mutationKey: MutationKey,\n ): OmitKeyof<MutationObserverOptions<any, any, any, any>, 'mutationKey'> {\n const defaults = [...this.#mutationDefaults.values()]\n\n const result: OmitKeyof<\n MutationObserverOptions<any, any, any, any>,\n 'mutationKey'\n > = {}\n\n defaults.forEach((queryDefault) => {\n if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {\n Object.assign(result, queryDefault.defaultOptions)\n }\n })\n\n return result\n }\n\n /**\n * Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the\n * caller into their final, defaulted form: merging the client's own `defaultOptions.queries`,\n * then `queryClient.setQueryDefaults` for the given `queryKey`, then the caller's options on\n * top. A no-op if the options are already defaulted (`_defaulted: true`).\n * @param options - The query options passed by the caller.\n * @returns The defaulted options, with `queryHash` and dependent defaults (e.g.\n * `refetchOnReconnect`) filled in.\n */\n defaultQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n >(\n options:\n | QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >\n | DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n ): DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n > {\n if (options._defaulted) {\n return options as DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n }\n\n const defaultedOptions = {\n ...this.#defaultOptions.queries,\n ...this.getQueryDefaults(options.queryKey),\n ...options,\n _defaulted: true,\n }\n\n if (!defaultedOptions.queryHash) {\n defaultedOptions.queryHash = hashQueryKeyByOptions(\n defaultedOptions.queryKey,\n defaultedOptions,\n )\n }\n\n // dependent default values\n if (defaultedOptions.refetchOnReconnect === undefined) {\n defaultedOptions.refetchOnReconnect =\n defaultedOptions.networkMode !== 'always'\n }\n if (defaultedOptions.throwOnError === undefined) {\n defaultedOptions.throwOnError = !!defaultedOptions.suspense\n }\n\n if (!defaultedOptions.networkMode && defaultedOptions.persister) {\n defaultedOptions.networkMode = 'offlineFirst'\n }\n\n if (defaultedOptions.queryFn === skipToken) {\n defaultedOptions.enabled = false\n }\n\n return defaultedOptions as DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n }\n\n /**\n * The mutation counterpart of {@link QueryClient#defaultQueryOptions}. Called by framework\n * adapters (e.g. inside `useMutation`) to merge the client's `defaultOptions.mutations`, then\n * `queryClient.setMutationDefaults` for the given `mutationKey`, then the caller's options on\n * top. A no-op if the options are already defaulted (`_defaulted: true`).\n * @param options - The mutation options passed by the caller.\n * @returns The defaulted options.\n */\n defaultMutationOptions<T extends MutationOptions<any, any, any, any>>(\n options?: T,\n ): T {\n if (options?._defaulted) {\n return options\n }\n return {\n ...this.#defaultOptions.mutations,\n ...(options?.mutationKey &&\n this.getMutationDefaults(options.mutationKey)),\n ...options,\n _defaulted: true,\n } as T\n }\n\n /**\n * Clears both the query cache and the mutation cache this client is connected to.\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * queryClient.clear()\n * ```\n */\n clear(): void {\n this.#queryCache.clear()\n this.#mutationCache.clear()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6EA,IAAa,cAAb,MAAyB;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAA4B,CAAC,GAAG;EAC1C,KAAK,cAAc,OAAO,cAAc,IAAI,WAAW;EACvD,KAAK,iBAAiB,OAAO,iBAAiB,IAAI,cAAc;EAChE,KAAK,kBAAkB,OAAO,kBAAkB,CAAC;EACjD,KAAK,iCAAiB,IAAI,IAAI;EAC9B,KAAK,oCAAoB,IAAI,IAAI;EACjC,KAAK,cAAc;CACrB;;;;;;;CAQA,QAAc;EACZ,KAAK;EACL,IAAI,KAAK,gBAAgB,GAAG;EAE5B,KAAK,oBAAoB,aAAa,UAAU,OAAO,YAAY;GACjE,IAAI,SAAS;IACX,MAAM,KAAK,sBAAsB;IACjC,KAAK,YAAY,QAAQ;GAC3B;EACF,CAAC;EACD,KAAK,qBAAqB,cAAc,UAAU,OAAO,WAAW;GAClE,IAAI,QAAQ;IACV,MAAM,KAAK,sBAAsB;IACjC,KAAK,Y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