@tanstack/query-core 5.69.2 → 5.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/index.cjs +2 -0
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/index.d.cts +1 -1
- package/build/legacy/index.d.ts +1 -1
- package/build/legacy/index.js +2 -1
- package/build/legacy/index.js.map +1 -1
- package/build/legacy/notifyManager.cjs +4 -1
- package/build/legacy/notifyManager.cjs.map +1 -1
- package/build/legacy/notifyManager.d.cts +2 -1
- package/build/legacy/notifyManager.d.ts +2 -1
- package/build/legacy/notifyManager.js +3 -1
- package/build/legacy/notifyManager.js.map +1 -1
- package/build/modern/index.cjs +2 -0
- package/build/modern/index.cjs.map +1 -1
- package/build/modern/index.d.cts +1 -1
- package/build/modern/index.d.ts +1 -1
- package/build/modern/index.js +2 -1
- package/build/modern/index.js.map +1 -1
- package/build/modern/notifyManager.cjs +4 -1
- package/build/modern/notifyManager.cjs.map +1 -1
- package/build/modern/notifyManager.d.cts +2 -1
- package/build/modern/notifyManager.d.ts +2 -1
- package/build/modern/notifyManager.js +3 -1
- package/build/modern/notifyManager.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/notifyManager.ts +3 -1
package/build/legacy/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ __export(src_exports, {
|
|
|
31
31
|
QueryCache: () => import_queryCache.QueryCache,
|
|
32
32
|
QueryClient: () => import_queryClient.QueryClient,
|
|
33
33
|
QueryObserver: () => import_queryObserver.QueryObserver,
|
|
34
|
+
defaultScheduler: () => import_notifyManager.defaultScheduler,
|
|
34
35
|
defaultShouldDehydrateMutation: () => import_hydration.defaultShouldDehydrateMutation,
|
|
35
36
|
defaultShouldDehydrateQuery: () => import_hydration.defaultShouldDehydrateQuery,
|
|
36
37
|
dehydrate: () => import_hydration.dehydrate,
|
|
@@ -79,6 +80,7 @@ var import_mutation = require("./mutation.cjs");
|
|
|
79
80
|
QueryCache,
|
|
80
81
|
QueryClient,
|
|
81
82
|
QueryObserver,
|
|
83
|
+
defaultScheduler,
|
|
82
84
|
defaultShouldDehydrateMutation,
|
|
83
85
|
defaultShouldDehydrateQuery,
|
|
84
86
|
dehydrate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\nexport { CancelledError } from './retryer'\nexport { QueryCache } from './queryCache'\nexport type { QueryCacheNotifyEvent } from './queryCache'\nexport { QueryClient } from './queryClient'\nexport { QueryObserver } from './queryObserver'\nexport { QueriesObserver } from './queriesObserver'\nexport { InfiniteQueryObserver } from './infiniteQueryObserver'\nexport { MutationCache } from './mutationCache'\nexport type { MutationCacheNotifyEvent } from './mutationCache'\nexport { MutationObserver } from './mutationObserver'\nexport { notifyManager } from './notifyManager'\nexport { focusManager } from './focusManager'\nexport { onlineManager } from './onlineManager'\nexport {\n hashKey,\n replaceEqualDeep,\n isServer,\n matchQuery,\n matchMutation,\n keepPreviousData,\n skipToken,\n} from './utils'\nexport type { MutationFilters, QueryFilters, Updater, SkipToken } from './utils'\nexport { isCancelledError } from './retryer'\nexport {\n dehydrate,\n hydrate,\n defaultShouldDehydrateQuery,\n defaultShouldDehydrateMutation,\n} from './hydration'\n\nexport { streamedQuery as experimental_streamedQuery } from './streamedQuery'\n\n// Types\nexport * from './types'\nexport type { QueryState } from './query'\nexport { Query } from './query'\nexport type { MutationState } from './mutation'\nexport { Mutation } from './mutation'\nexport type {\n DehydrateOptions,\n DehydratedState,\n HydrateOptions,\n} from './hydration'\nexport type { QueriesObserverOptions } from './queriesObserver'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAA+B;AAC/B,wBAA2B;AAE3B,yBAA4B;AAC5B,2BAA8B;AAC9B,6BAAgC;AAChC,mCAAsC;AACtC,2BAA8B;AAE9B,8BAAiC;AACjC,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\nexport { CancelledError } from './retryer'\nexport { QueryCache } from './queryCache'\nexport type { QueryCacheNotifyEvent } from './queryCache'\nexport { QueryClient } from './queryClient'\nexport { QueryObserver } from './queryObserver'\nexport { QueriesObserver } from './queriesObserver'\nexport { InfiniteQueryObserver } from './infiniteQueryObserver'\nexport { MutationCache } from './mutationCache'\nexport type { MutationCacheNotifyEvent } from './mutationCache'\nexport { MutationObserver } from './mutationObserver'\nexport { notifyManager, defaultScheduler } from './notifyManager'\nexport { focusManager } from './focusManager'\nexport { onlineManager } from './onlineManager'\nexport {\n hashKey,\n replaceEqualDeep,\n isServer,\n matchQuery,\n matchMutation,\n keepPreviousData,\n skipToken,\n} from './utils'\nexport type { MutationFilters, QueryFilters, Updater, SkipToken } from './utils'\nexport { isCancelledError } from './retryer'\nexport {\n dehydrate,\n hydrate,\n defaultShouldDehydrateQuery,\n defaultShouldDehydrateMutation,\n} from './hydration'\n\nexport { streamedQuery as experimental_streamedQuery } from './streamedQuery'\n\n// Types\nexport * from './types'\nexport type { QueryState } from './query'\nexport { Query } from './query'\nexport type { MutationState } from './mutation'\nexport { Mutation } from './mutation'\nexport type {\n DehydrateOptions,\n DehydratedState,\n HydrateOptions,\n} from './hydration'\nexport type { QueriesObserverOptions } from './queriesObserver'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAA+B;AAC/B,wBAA2B;AAE3B,yBAA4B;AAC5B,2BAA8B;AAC9B,6BAAgC;AAChC,mCAAsC;AACtC,2BAA8B;AAE9B,8BAAiC;AACjC,2BAAgD;AAChD,0BAA6B;AAC7B,2BAA8B;AAC9B,mBAQO;AAEP,IAAAA,kBAAiC;AACjC,uBAKO;AAEP,2BAA4D;AAG5D,wBAAc,wBApCd;AAsCA,mBAAsB;AAEtB,sBAAyB;","names":["import_retryer"]}
|
package/build/legacy/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { I as AnyDataTag, b1 as CancelOptions, C as CancelledError, J as DataTag, z as DefaultError, b0 as DefaultOptions, af as DefaultedInfiniteQueryObserverOptions, ad as DefaultedQueryObserverOptions, aK as DefinedInfiniteQueryObserverResult, aB as DefinedQueryObserverResult, D as DehydrateOptions, x as DehydratedState, V as Enabled, ai as EnsureInfiniteQueryDataOptions, ah as EnsureQueryDataOptions, aj as FetchInfiniteQueryOptions, aq as FetchNextPageOptions, ar as FetchPreviousPageOptions, ag as FetchQueryOptions, at as FetchStatus, a1 as GetNextPageParamFunction, a0 as GetPreviousPageParamFunction, H as HydrateOptions, K as InferDataFromTag, L as InferErrorFromTag, a2 as InfiniteData, aD as InfiniteQueryObserverBaseResult, aG as InfiniteQueryObserverLoadingErrorResult, aF as InfiniteQueryObserverLoadingResult, ae as InfiniteQueryObserverOptions, aE as InfiniteQueryObserverPendingResult, aJ as InfiniteQueryObserverPlaceholderResult, aH as InfiniteQueryObserverRefetchErrorResult, aL as InfiniteQueryObserverResult, aI as InfiniteQueryObserverSuccessResult, a8 as InfiniteQueryPageParamsOptions, Y as InitialDataFunction, a7 as InitialPageParam, ao as InvalidateOptions, am as InvalidateQueryFilters, aU as MutateFunction, aT as MutateOptions, w as Mutation, M as MutationCache, d as MutationCacheNotifyEvent, g as MutationFilters, aQ as MutationFunction, aM as MutationKey, aP as MutationMeta, e as MutationObserver, aV as MutationObserverBaseResult, aY as MutationObserverErrorResult, aW as MutationObserverIdleResult, aX as MutationObserverLoadingResult, aS as MutationObserverOptions, a_ as MutationObserverResult, aZ as MutationObserverSuccessResult, aR as MutationOptions, aO as MutationScope, v as MutationState, aN as MutationStatus, a4 as NetworkMode, N as NoInfer, b4 as NotifyEvent, b3 as NotifyEventType, a5 as NotifyOnChangeProps, O as OmitKeyof, ac as Optional, y as Override, Z as PlaceholderDataFunction, _ as QueriesPlaceholderDataFunction, u as Query, Q as QueryCache, a as QueryCacheNotifyEvent, b as QueryClient, a$ as QueryClientConfig, j as QueryFilters, P as QueryFunction, X as QueryFunctionContext, A as QueryKey, $ as QueryKeyHashFunction, a3 as QueryMeta, c as QueryObserver, au as QueryObserverBaseResult, ax as QueryObserverLoadingErrorResult, aw as QueryObserverLoadingResult, aa as QueryObserverOptions, av as QueryObserverPendingResult, aA as QueryObserverPlaceholderResult, ay as QueryObserverRefetchErrorResult, aC as QueryObserverResult, az as QueryObserverSuccessResult, a6 as QueryOptions, W as QueryPersister, t as QueryState, as as QueryStatus, al as RefetchOptions, an as RefetchQueryFilters, R as Register, ap as ResetOptions, ak as ResultOptions, b2 as SetDataOptions, S as SkipToken, T as StaleTime, a9 as ThrowOnError, G as UnsetMarker, U as Updater, ab as WithRequired, E as dataTagErrorSymbol, B as dataTagSymbol, q as defaultShouldDehydrateMutation, p as defaultShouldDehydrateQuery, n as dehydrate, h as hashKey, o as hydrate, l as isCancelledError, i as isServer, k as keepPreviousData, f as matchMutation, m as matchQuery, r as replaceEqualDeep, s as skipToken, F as unsetMarker } from './hydration-CIqZ2rw6.cjs';
|
|
2
2
|
export { QueriesObserver, QueriesObserverOptions } from './queriesObserver.cjs';
|
|
3
3
|
export { InfiniteQueryObserver } from './infiniteQueryObserver.cjs';
|
|
4
|
-
export { notifyManager } from './notifyManager.cjs';
|
|
4
|
+
export { defaultScheduler, notifyManager } from './notifyManager.cjs';
|
|
5
5
|
export { focusManager } from './focusManager.cjs';
|
|
6
6
|
export { onlineManager } from './onlineManager.cjs';
|
|
7
7
|
export { streamedQuery as experimental_streamedQuery } from './streamedQuery.cjs';
|
package/build/legacy/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { I as AnyDataTag, b1 as CancelOptions, C as CancelledError, J as DataTag, z as DefaultError, b0 as DefaultOptions, af as DefaultedInfiniteQueryObserverOptions, ad as DefaultedQueryObserverOptions, aK as DefinedInfiniteQueryObserverResult, aB as DefinedQueryObserverResult, D as DehydrateOptions, x as DehydratedState, V as Enabled, ai as EnsureInfiniteQueryDataOptions, ah as EnsureQueryDataOptions, aj as FetchInfiniteQueryOptions, aq as FetchNextPageOptions, ar as FetchPreviousPageOptions, ag as FetchQueryOptions, at as FetchStatus, a1 as GetNextPageParamFunction, a0 as GetPreviousPageParamFunction, H as HydrateOptions, K as InferDataFromTag, L as InferErrorFromTag, a2 as InfiniteData, aD as InfiniteQueryObserverBaseResult, aG as InfiniteQueryObserverLoadingErrorResult, aF as InfiniteQueryObserverLoadingResult, ae as InfiniteQueryObserverOptions, aE as InfiniteQueryObserverPendingResult, aJ as InfiniteQueryObserverPlaceholderResult, aH as InfiniteQueryObserverRefetchErrorResult, aL as InfiniteQueryObserverResult, aI as InfiniteQueryObserverSuccessResult, a8 as InfiniteQueryPageParamsOptions, Y as InitialDataFunction, a7 as InitialPageParam, ao as InvalidateOptions, am as InvalidateQueryFilters, aU as MutateFunction, aT as MutateOptions, w as Mutation, M as MutationCache, d as MutationCacheNotifyEvent, g as MutationFilters, aQ as MutationFunction, aM as MutationKey, aP as MutationMeta, e as MutationObserver, aV as MutationObserverBaseResult, aY as MutationObserverErrorResult, aW as MutationObserverIdleResult, aX as MutationObserverLoadingResult, aS as MutationObserverOptions, a_ as MutationObserverResult, aZ as MutationObserverSuccessResult, aR as MutationOptions, aO as MutationScope, v as MutationState, aN as MutationStatus, a4 as NetworkMode, N as NoInfer, b4 as NotifyEvent, b3 as NotifyEventType, a5 as NotifyOnChangeProps, O as OmitKeyof, ac as Optional, y as Override, Z as PlaceholderDataFunction, _ as QueriesPlaceholderDataFunction, u as Query, Q as QueryCache, a as QueryCacheNotifyEvent, b as QueryClient, a$ as QueryClientConfig, j as QueryFilters, P as QueryFunction, X as QueryFunctionContext, A as QueryKey, $ as QueryKeyHashFunction, a3 as QueryMeta, c as QueryObserver, au as QueryObserverBaseResult, ax as QueryObserverLoadingErrorResult, aw as QueryObserverLoadingResult, aa as QueryObserverOptions, av as QueryObserverPendingResult, aA as QueryObserverPlaceholderResult, ay as QueryObserverRefetchErrorResult, aC as QueryObserverResult, az as QueryObserverSuccessResult, a6 as QueryOptions, W as QueryPersister, t as QueryState, as as QueryStatus, al as RefetchOptions, an as RefetchQueryFilters, R as Register, ap as ResetOptions, ak as ResultOptions, b2 as SetDataOptions, S as SkipToken, T as StaleTime, a9 as ThrowOnError, G as UnsetMarker, U as Updater, ab as WithRequired, E as dataTagErrorSymbol, B as dataTagSymbol, q as defaultShouldDehydrateMutation, p as defaultShouldDehydrateQuery, n as dehydrate, h as hashKey, o as hydrate, l as isCancelledError, i as isServer, k as keepPreviousData, f as matchMutation, m as matchQuery, r as replaceEqualDeep, s as skipToken, F as unsetMarker } from './hydration-Cik0p0G0.js';
|
|
2
2
|
export { QueriesObserver, QueriesObserverOptions } from './queriesObserver.js';
|
|
3
3
|
export { InfiniteQueryObserver } from './infiniteQueryObserver.js';
|
|
4
|
-
export { notifyManager } from './notifyManager.js';
|
|
4
|
+
export { defaultScheduler, notifyManager } from './notifyManager.js';
|
|
5
5
|
export { focusManager } from './focusManager.js';
|
|
6
6
|
export { onlineManager } from './onlineManager.js';
|
|
7
7
|
export { streamedQuery as experimental_streamedQuery } from './streamedQuery.js';
|
package/build/legacy/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { QueriesObserver } from "./queriesObserver.js";
|
|
|
9
9
|
import { InfiniteQueryObserver } from "./infiniteQueryObserver.js";
|
|
10
10
|
import { MutationCache } from "./mutationCache.js";
|
|
11
11
|
import { MutationObserver } from "./mutationObserver.js";
|
|
12
|
-
import { notifyManager } from "./notifyManager.js";
|
|
12
|
+
import { notifyManager, defaultScheduler } from "./notifyManager.js";
|
|
13
13
|
import { focusManager } from "./focusManager.js";
|
|
14
14
|
import { onlineManager } from "./onlineManager.js";
|
|
15
15
|
import {
|
|
@@ -43,6 +43,7 @@ export {
|
|
|
43
43
|
QueryCache,
|
|
44
44
|
QueryClient,
|
|
45
45
|
QueryObserver,
|
|
46
|
+
defaultScheduler,
|
|
46
47
|
defaultShouldDehydrateMutation,
|
|
47
48
|
defaultShouldDehydrateQuery,
|
|
48
49
|
dehydrate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\nexport { CancelledError } from './retryer'\nexport { QueryCache } from './queryCache'\nexport type { QueryCacheNotifyEvent } from './queryCache'\nexport { QueryClient } from './queryClient'\nexport { QueryObserver } from './queryObserver'\nexport { QueriesObserver } from './queriesObserver'\nexport { InfiniteQueryObserver } from './infiniteQueryObserver'\nexport { MutationCache } from './mutationCache'\nexport type { MutationCacheNotifyEvent } from './mutationCache'\nexport { MutationObserver } from './mutationObserver'\nexport { notifyManager } from './notifyManager'\nexport { focusManager } from './focusManager'\nexport { onlineManager } from './onlineManager'\nexport {\n hashKey,\n replaceEqualDeep,\n isServer,\n matchQuery,\n matchMutation,\n keepPreviousData,\n skipToken,\n} from './utils'\nexport type { MutationFilters, QueryFilters, Updater, SkipToken } from './utils'\nexport { isCancelledError } from './retryer'\nexport {\n dehydrate,\n hydrate,\n defaultShouldDehydrateQuery,\n defaultShouldDehydrateMutation,\n} from './hydration'\n\nexport { streamedQuery as experimental_streamedQuery } from './streamedQuery'\n\n// Types\nexport * from './types'\nexport type { QueryState } from './query'\nexport { Query } from './query'\nexport type { MutationState } from './mutation'\nexport { Mutation } from './mutation'\nexport type {\n DehydrateOptions,\n DehydratedState,\n HydrateOptions,\n} from './hydration'\nexport type { QueriesObserverOptions } from './queriesObserver'\n"],"mappings":";;;AAEA,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAE3B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAE9B,SAAS,wBAAwB;AACjC,SAAS,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\nexport { CancelledError } from './retryer'\nexport { QueryCache } from './queryCache'\nexport type { QueryCacheNotifyEvent } from './queryCache'\nexport { QueryClient } from './queryClient'\nexport { QueryObserver } from './queryObserver'\nexport { QueriesObserver } from './queriesObserver'\nexport { InfiniteQueryObserver } from './infiniteQueryObserver'\nexport { MutationCache } from './mutationCache'\nexport type { MutationCacheNotifyEvent } from './mutationCache'\nexport { MutationObserver } from './mutationObserver'\nexport { notifyManager, defaultScheduler } from './notifyManager'\nexport { focusManager } from './focusManager'\nexport { onlineManager } from './onlineManager'\nexport {\n hashKey,\n replaceEqualDeep,\n isServer,\n matchQuery,\n matchMutation,\n keepPreviousData,\n skipToken,\n} from './utils'\nexport type { MutationFilters, QueryFilters, Updater, SkipToken } from './utils'\nexport { isCancelledError } from './retryer'\nexport {\n dehydrate,\n hydrate,\n defaultShouldDehydrateQuery,\n defaultShouldDehydrateMutation,\n} from './hydration'\n\nexport { streamedQuery as experimental_streamedQuery } from './streamedQuery'\n\n// Types\nexport * from './types'\nexport type { QueryState } from './query'\nexport { Query } from './query'\nexport type { MutationState } from './mutation'\nexport { Mutation } from './mutation'\nexport type {\n DehydrateOptions,\n DehydratedState,\n HydrateOptions,\n} from './hydration'\nexport type { QueriesObserverOptions } from './queriesObserver'\n"],"mappings":";;;AAEA,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAE3B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAE9B,SAAS,wBAAwB;AACjC,SAAS,eAAe,wBAAwB;AAChD,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAA0B,qBAAkC;AAG5D,cAAc;AAEd,SAAS,aAAa;AAEtB,SAAS,gBAAgB;","names":[]}
|
|
@@ -21,9 +21,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var notifyManager_exports = {};
|
|
22
22
|
__export(notifyManager_exports, {
|
|
23
23
|
createNotifyManager: () => createNotifyManager,
|
|
24
|
+
defaultScheduler: () => defaultScheduler,
|
|
24
25
|
notifyManager: () => notifyManager
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(notifyManager_exports);
|
|
28
|
+
var defaultScheduler = (cb) => setTimeout(cb, 0);
|
|
27
29
|
function createNotifyManager() {
|
|
28
30
|
let queue = [];
|
|
29
31
|
let transactions = 0;
|
|
@@ -33,7 +35,7 @@ function createNotifyManager() {
|
|
|
33
35
|
let batchNotifyFn = (callback) => {
|
|
34
36
|
callback();
|
|
35
37
|
};
|
|
36
|
-
let scheduleFn =
|
|
38
|
+
let scheduleFn = defaultScheduler;
|
|
37
39
|
const schedule = (callback) => {
|
|
38
40
|
if (transactions) {
|
|
39
41
|
queue.push(callback);
|
|
@@ -104,6 +106,7 @@ var notifyManager = createNotifyManager();
|
|
|
104
106
|
// Annotate the CommonJS export names for ESM import in node:
|
|
105
107
|
0 && (module.exports = {
|
|
106
108
|
createNotifyManager,
|
|
109
|
+
defaultScheduler,
|
|
107
110
|
notifyManager
|
|
108
111
|
});
|
|
109
112
|
//# sourceMappingURL=notifyManager.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/notifyManager.ts"],"sourcesContent":["// TYPES\n\ntype NotifyCallback = () => void\n\ntype NotifyFunction = (callback: () => void) => void\n\ntype BatchNotifyFunction = (callback: () => void) => void\n\ntype BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void\n\ntype ScheduleFunction = (callback: () => void) => void\n\nexport function createNotifyManager() {\n let queue: Array<NotifyCallback> = []\n let transactions = 0\n let notifyFn: NotifyFunction = (callback) => {\n callback()\n }\n let batchNotifyFn: BatchNotifyFunction = (callback: () => void) => {\n callback()\n }\n let scheduleFn
|
|
1
|
+
{"version":3,"sources":["../../src/notifyManager.ts"],"sourcesContent":["// TYPES\n\ntype NotifyCallback = () => void\n\ntype NotifyFunction = (callback: () => void) => void\n\ntype BatchNotifyFunction = (callback: () => void) => void\n\ntype BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void\n\ntype ScheduleFunction = (callback: () => void) => void\n\nexport const defaultScheduler: ScheduleFunction = (cb) => setTimeout(cb, 0)\n\nexport function createNotifyManager() {\n let queue: Array<NotifyCallback> = []\n let transactions = 0\n let notifyFn: NotifyFunction = (callback) => {\n callback()\n }\n let batchNotifyFn: BatchNotifyFunction = (callback: () => void) => {\n callback()\n }\n let scheduleFn = defaultScheduler\n\n const schedule = (callback: NotifyCallback): void => {\n if (transactions) {\n queue.push(callback)\n } else {\n scheduleFn(() => {\n notifyFn(callback)\n })\n }\n }\n const flush = (): void => {\n const originalQueue = queue\n queue = []\n if (originalQueue.length) {\n scheduleFn(() => {\n batchNotifyFn(() => {\n originalQueue.forEach((callback) => {\n notifyFn(callback)\n })\n })\n })\n }\n }\n\n return {\n batch: <T>(callback: () => T): T => {\n let result\n transactions++\n try {\n result = callback()\n } finally {\n transactions--\n if (!transactions) {\n flush()\n }\n }\n return result\n },\n /**\n * All calls to the wrapped function will be batched.\n */\n batchCalls: <T extends Array<unknown>>(\n callback: BatchCallsCallback<T>,\n ): BatchCallsCallback<T> => {\n return (...args) => {\n schedule(() => {\n callback(...args)\n })\n }\n },\n schedule,\n /**\n * Use this method to set a custom notify function.\n * This can be used to for example wrap notifications with `React.act` while running tests.\n */\n setNotifyFunction: (fn: NotifyFunction) => {\n notifyFn = fn\n },\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n setBatchNotifyFunction: (fn: BatchNotifyFunction) => {\n batchNotifyFn = fn\n },\n setScheduler: (fn: ScheduleFunction) => {\n scheduleFn = fn\n },\n } as const\n}\n\n// SINGLETON\nexport const notifyManager = createNotifyManager()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,IAAM,mBAAqC,CAAC,OAAO,WAAW,IAAI,CAAC;AAEnE,SAAS,sBAAsB;AACpC,MAAI,QAA+B,CAAC;AACpC,MAAI,eAAe;AACnB,MAAI,WAA2B,CAAC,aAAa;AAC3C,aAAS;AAAA,EACX;AACA,MAAI,gBAAqC,CAAC,aAAyB;AACjE,aAAS;AAAA,EACX;AACA,MAAI,aAAa;AAEjB,QAAM,WAAW,CAAC,aAAmC;AACnD,QAAI,cAAc;AAChB,YAAM,KAAK,QAAQ;AAAA,IACrB,OAAO;AACL,iBAAW,MAAM;AACf,iBAAS,QAAQ;AAAA,MACnB,CAAC;AAAA,IACH;AAAA,EACF;AACA,QAAM,QAAQ,MAAY;AACxB,UAAM,gBAAgB;AACtB,YAAQ,CAAC;AACT,QAAI,cAAc,QAAQ;AACxB,iBAAW,MAAM;AACf,sBAAc,MAAM;AAClB,wBAAc,QAAQ,CAAC,aAAa;AAClC,qBAAS,QAAQ;AAAA,UACnB,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO,CAAI,aAAyB;AAClC,UAAI;AACJ;AACA,UAAI;AACF,iBAAS,SAAS;AAAA,MACpB,UAAE;AACA;AACA,YAAI,CAAC,cAAc;AACjB,gBAAM;AAAA,QACR;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA;AAAA;AAAA;AAAA,IAIA,YAAY,CACV,aAC0B;AAC1B,aAAO,IAAI,SAAS;AAClB,iBAAS,MAAM;AACb,mBAAS,GAAG,IAAI;AAAA,QAClB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,mBAAmB,CAAC,OAAuB;AACzC,iBAAW;AAAA,IACb;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,wBAAwB,CAAC,OAA4B;AACnD,sBAAgB;AAAA,IAClB;AAAA,IACA,cAAc,CAAC,OAAyB;AACtC,mBAAa;AAAA,IACf;AAAA,EACF;AACF;AAGO,IAAM,gBAAgB,oBAAoB;","names":[]}
|
|
@@ -3,6 +3,7 @@ type NotifyFunction = (callback: () => void) => void;
|
|
|
3
3
|
type BatchNotifyFunction = (callback: () => void) => void;
|
|
4
4
|
type BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void;
|
|
5
5
|
type ScheduleFunction = (callback: () => void) => void;
|
|
6
|
+
declare const defaultScheduler: ScheduleFunction;
|
|
6
7
|
declare function createNotifyManager(): {
|
|
7
8
|
readonly batch: <T>(callback: () => T) => T;
|
|
8
9
|
/**
|
|
@@ -42,4 +43,4 @@ declare const notifyManager: {
|
|
|
42
43
|
readonly setScheduler: (fn: ScheduleFunction) => void;
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
export { createNotifyManager, notifyManager };
|
|
46
|
+
export { createNotifyManager, defaultScheduler, notifyManager };
|
|
@@ -3,6 +3,7 @@ type NotifyFunction = (callback: () => void) => void;
|
|
|
3
3
|
type BatchNotifyFunction = (callback: () => void) => void;
|
|
4
4
|
type BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void;
|
|
5
5
|
type ScheduleFunction = (callback: () => void) => void;
|
|
6
|
+
declare const defaultScheduler: ScheduleFunction;
|
|
6
7
|
declare function createNotifyManager(): {
|
|
7
8
|
readonly batch: <T>(callback: () => T) => T;
|
|
8
9
|
/**
|
|
@@ -42,4 +43,4 @@ declare const notifyManager: {
|
|
|
42
43
|
readonly setScheduler: (fn: ScheduleFunction) => void;
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
export { createNotifyManager, notifyManager };
|
|
46
|
+
export { createNotifyManager, defaultScheduler, notifyManager };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./chunk-2HYBKCYP.js";
|
|
2
2
|
|
|
3
3
|
// src/notifyManager.ts
|
|
4
|
+
var defaultScheduler = (cb) => setTimeout(cb, 0);
|
|
4
5
|
function createNotifyManager() {
|
|
5
6
|
let queue = [];
|
|
6
7
|
let transactions = 0;
|
|
@@ -10,7 +11,7 @@ function createNotifyManager() {
|
|
|
10
11
|
let batchNotifyFn = (callback) => {
|
|
11
12
|
callback();
|
|
12
13
|
};
|
|
13
|
-
let scheduleFn =
|
|
14
|
+
let scheduleFn = defaultScheduler;
|
|
14
15
|
const schedule = (callback) => {
|
|
15
16
|
if (transactions) {
|
|
16
17
|
queue.push(callback);
|
|
@@ -80,6 +81,7 @@ function createNotifyManager() {
|
|
|
80
81
|
var notifyManager = createNotifyManager();
|
|
81
82
|
export {
|
|
82
83
|
createNotifyManager,
|
|
84
|
+
defaultScheduler,
|
|
83
85
|
notifyManager
|
|
84
86
|
};
|
|
85
87
|
//# sourceMappingURL=notifyManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/notifyManager.ts"],"sourcesContent":["// TYPES\n\ntype NotifyCallback = () => void\n\ntype NotifyFunction = (callback: () => void) => void\n\ntype BatchNotifyFunction = (callback: () => void) => void\n\ntype BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void\n\ntype ScheduleFunction = (callback: () => void) => void\n\nexport function createNotifyManager() {\n let queue: Array<NotifyCallback> = []\n let transactions = 0\n let notifyFn: NotifyFunction = (callback) => {\n callback()\n }\n let batchNotifyFn: BatchNotifyFunction = (callback: () => void) => {\n callback()\n }\n let scheduleFn
|
|
1
|
+
{"version":3,"sources":["../../src/notifyManager.ts"],"sourcesContent":["// TYPES\n\ntype NotifyCallback = () => void\n\ntype NotifyFunction = (callback: () => void) => void\n\ntype BatchNotifyFunction = (callback: () => void) => void\n\ntype BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void\n\ntype ScheduleFunction = (callback: () => void) => void\n\nexport const defaultScheduler: ScheduleFunction = (cb) => setTimeout(cb, 0)\n\nexport function createNotifyManager() {\n let queue: Array<NotifyCallback> = []\n let transactions = 0\n let notifyFn: NotifyFunction = (callback) => {\n callback()\n }\n let batchNotifyFn: BatchNotifyFunction = (callback: () => void) => {\n callback()\n }\n let scheduleFn = defaultScheduler\n\n const schedule = (callback: NotifyCallback): void => {\n if (transactions) {\n queue.push(callback)\n } else {\n scheduleFn(() => {\n notifyFn(callback)\n })\n }\n }\n const flush = (): void => {\n const originalQueue = queue\n queue = []\n if (originalQueue.length) {\n scheduleFn(() => {\n batchNotifyFn(() => {\n originalQueue.forEach((callback) => {\n notifyFn(callback)\n })\n })\n })\n }\n }\n\n return {\n batch: <T>(callback: () => T): T => {\n let result\n transactions++\n try {\n result = callback()\n } finally {\n transactions--\n if (!transactions) {\n flush()\n }\n }\n return result\n },\n /**\n * All calls to the wrapped function will be batched.\n */\n batchCalls: <T extends Array<unknown>>(\n callback: BatchCallsCallback<T>,\n ): BatchCallsCallback<T> => {\n return (...args) => {\n schedule(() => {\n callback(...args)\n })\n }\n },\n schedule,\n /**\n * Use this method to set a custom notify function.\n * This can be used to for example wrap notifications with `React.act` while running tests.\n */\n setNotifyFunction: (fn: NotifyFunction) => {\n notifyFn = fn\n },\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n setBatchNotifyFunction: (fn: BatchNotifyFunction) => {\n batchNotifyFn = fn\n },\n setScheduler: (fn: ScheduleFunction) => {\n scheduleFn = fn\n },\n } as const\n}\n\n// SINGLETON\nexport const notifyManager = createNotifyManager()\n"],"mappings":";;;AAYO,IAAM,mBAAqC,CAAC,OAAO,WAAW,IAAI,CAAC;AAEnE,SAAS,sBAAsB;AACpC,MAAI,QAA+B,CAAC;AACpC,MAAI,eAAe;AACnB,MAAI,WAA2B,CAAC,aAAa;AAC3C,aAAS;AAAA,EACX;AACA,MAAI,gBAAqC,CAAC,aAAyB;AACjE,aAAS;AAAA,EACX;AACA,MAAI,aAAa;AAEjB,QAAM,WAAW,CAAC,aAAmC;AACnD,QAAI,cAAc;AAChB,YAAM,KAAK,QAAQ;AAAA,IACrB,OAAO;AACL,iBAAW,MAAM;AACf,iBAAS,QAAQ;AAAA,MACnB,CAAC;AAAA,IACH;AAAA,EACF;AACA,QAAM,QAAQ,MAAY;AACxB,UAAM,gBAAgB;AACtB,YAAQ,CAAC;AACT,QAAI,cAAc,QAAQ;AACxB,iBAAW,MAAM;AACf,sBAAc,MAAM;AAClB,wBAAc,QAAQ,CAAC,aAAa;AAClC,qBAAS,QAAQ;AAAA,UACnB,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO,CAAI,aAAyB;AAClC,UAAI;AACJ;AACA,UAAI;AACF,iBAAS,SAAS;AAAA,MACpB,UAAE;AACA;AACA,YAAI,CAAC,cAAc;AACjB,gBAAM;AAAA,QACR;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA;AAAA;AAAA;AAAA,IAIA,YAAY,CACV,aAC0B;AAC1B,aAAO,IAAI,SAAS;AAClB,iBAAS,MAAM;AACb,mBAAS,GAAG,IAAI;AAAA,QAClB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,mBAAmB,CAAC,OAAuB;AACzC,iBAAW;AAAA,IACb;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,wBAAwB,CAAC,OAA4B;AACnD,sBAAgB;AAAA,IAClB;AAAA,IACA,cAAc,CAAC,OAAyB;AACtC,mBAAa;AAAA,IACf;AAAA,EACF;AACF;AAGO,IAAM,gBAAgB,oBAAoB;","names":[]}
|
package/build/modern/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ __export(src_exports, {
|
|
|
31
31
|
QueryCache: () => import_queryCache.QueryCache,
|
|
32
32
|
QueryClient: () => import_queryClient.QueryClient,
|
|
33
33
|
QueryObserver: () => import_queryObserver.QueryObserver,
|
|
34
|
+
defaultScheduler: () => import_notifyManager.defaultScheduler,
|
|
34
35
|
defaultShouldDehydrateMutation: () => import_hydration.defaultShouldDehydrateMutation,
|
|
35
36
|
defaultShouldDehydrateQuery: () => import_hydration.defaultShouldDehydrateQuery,
|
|
36
37
|
dehydrate: () => import_hydration.dehydrate,
|
|
@@ -79,6 +80,7 @@ var import_mutation = require("./mutation.cjs");
|
|
|
79
80
|
QueryCache,
|
|
80
81
|
QueryClient,
|
|
81
82
|
QueryObserver,
|
|
83
|
+
defaultScheduler,
|
|
82
84
|
defaultShouldDehydrateMutation,
|
|
83
85
|
defaultShouldDehydrateQuery,
|
|
84
86
|
dehydrate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\nexport { CancelledError } from './retryer'\nexport { QueryCache } from './queryCache'\nexport type { QueryCacheNotifyEvent } from './queryCache'\nexport { QueryClient } from './queryClient'\nexport { QueryObserver } from './queryObserver'\nexport { QueriesObserver } from './queriesObserver'\nexport { InfiniteQueryObserver } from './infiniteQueryObserver'\nexport { MutationCache } from './mutationCache'\nexport type { MutationCacheNotifyEvent } from './mutationCache'\nexport { MutationObserver } from './mutationObserver'\nexport { notifyManager } from './notifyManager'\nexport { focusManager } from './focusManager'\nexport { onlineManager } from './onlineManager'\nexport {\n hashKey,\n replaceEqualDeep,\n isServer,\n matchQuery,\n matchMutation,\n keepPreviousData,\n skipToken,\n} from './utils'\nexport type { MutationFilters, QueryFilters, Updater, SkipToken } from './utils'\nexport { isCancelledError } from './retryer'\nexport {\n dehydrate,\n hydrate,\n defaultShouldDehydrateQuery,\n defaultShouldDehydrateMutation,\n} from './hydration'\n\nexport { streamedQuery as experimental_streamedQuery } from './streamedQuery'\n\n// Types\nexport * from './types'\nexport type { QueryState } from './query'\nexport { Query } from './query'\nexport type { MutationState } from './mutation'\nexport { Mutation } from './mutation'\nexport type {\n DehydrateOptions,\n DehydratedState,\n HydrateOptions,\n} from './hydration'\nexport type { QueriesObserverOptions } from './queriesObserver'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAA+B;AAC/B,wBAA2B;AAE3B,yBAA4B;AAC5B,2BAA8B;AAC9B,6BAAgC;AAChC,mCAAsC;AACtC,2BAA8B;AAE9B,8BAAiC;AACjC,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\nexport { CancelledError } from './retryer'\nexport { QueryCache } from './queryCache'\nexport type { QueryCacheNotifyEvent } from './queryCache'\nexport { QueryClient } from './queryClient'\nexport { QueryObserver } from './queryObserver'\nexport { QueriesObserver } from './queriesObserver'\nexport { InfiniteQueryObserver } from './infiniteQueryObserver'\nexport { MutationCache } from './mutationCache'\nexport type { MutationCacheNotifyEvent } from './mutationCache'\nexport { MutationObserver } from './mutationObserver'\nexport { notifyManager, defaultScheduler } from './notifyManager'\nexport { focusManager } from './focusManager'\nexport { onlineManager } from './onlineManager'\nexport {\n hashKey,\n replaceEqualDeep,\n isServer,\n matchQuery,\n matchMutation,\n keepPreviousData,\n skipToken,\n} from './utils'\nexport type { MutationFilters, QueryFilters, Updater, SkipToken } from './utils'\nexport { isCancelledError } from './retryer'\nexport {\n dehydrate,\n hydrate,\n defaultShouldDehydrateQuery,\n defaultShouldDehydrateMutation,\n} from './hydration'\n\nexport { streamedQuery as experimental_streamedQuery } from './streamedQuery'\n\n// Types\nexport * from './types'\nexport type { QueryState } from './query'\nexport { Query } from './query'\nexport type { MutationState } from './mutation'\nexport { Mutation } from './mutation'\nexport type {\n DehydrateOptions,\n DehydratedState,\n HydrateOptions,\n} from './hydration'\nexport type { QueriesObserverOptions } from './queriesObserver'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAA+B;AAC/B,wBAA2B;AAE3B,yBAA4B;AAC5B,2BAA8B;AAC9B,6BAAgC;AAChC,mCAAsC;AACtC,2BAA8B;AAE9B,8BAAiC;AACjC,2BAAgD;AAChD,0BAA6B;AAC7B,2BAA8B;AAC9B,mBAQO;AAEP,IAAAA,kBAAiC;AACjC,uBAKO;AAEP,2BAA4D;AAG5D,wBAAc,wBApCd;AAsCA,mBAAsB;AAEtB,sBAAyB;","names":["import_retryer"]}
|
package/build/modern/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { I as AnyDataTag, b1 as CancelOptions, C as CancelledError, J as DataTag, z as DefaultError, b0 as DefaultOptions, af as DefaultedInfiniteQueryObserverOptions, ad as DefaultedQueryObserverOptions, aK as DefinedInfiniteQueryObserverResult, aB as DefinedQueryObserverResult, D as DehydrateOptions, x as DehydratedState, V as Enabled, ai as EnsureInfiniteQueryDataOptions, ah as EnsureQueryDataOptions, aj as FetchInfiniteQueryOptions, aq as FetchNextPageOptions, ar as FetchPreviousPageOptions, ag as FetchQueryOptions, at as FetchStatus, a1 as GetNextPageParamFunction, a0 as GetPreviousPageParamFunction, H as HydrateOptions, K as InferDataFromTag, L as InferErrorFromTag, a2 as InfiniteData, aD as InfiniteQueryObserverBaseResult, aG as InfiniteQueryObserverLoadingErrorResult, aF as InfiniteQueryObserverLoadingResult, ae as InfiniteQueryObserverOptions, aE as InfiniteQueryObserverPendingResult, aJ as InfiniteQueryObserverPlaceholderResult, aH as InfiniteQueryObserverRefetchErrorResult, aL as InfiniteQueryObserverResult, aI as InfiniteQueryObserverSuccessResult, a8 as InfiniteQueryPageParamsOptions, Y as InitialDataFunction, a7 as InitialPageParam, ao as InvalidateOptions, am as InvalidateQueryFilters, aU as MutateFunction, aT as MutateOptions, w as Mutation, M as MutationCache, d as MutationCacheNotifyEvent, g as MutationFilters, aQ as MutationFunction, aM as MutationKey, aP as MutationMeta, e as MutationObserver, aV as MutationObserverBaseResult, aY as MutationObserverErrorResult, aW as MutationObserverIdleResult, aX as MutationObserverLoadingResult, aS as MutationObserverOptions, a_ as MutationObserverResult, aZ as MutationObserverSuccessResult, aR as MutationOptions, aO as MutationScope, v as MutationState, aN as MutationStatus, a4 as NetworkMode, N as NoInfer, b4 as NotifyEvent, b3 as NotifyEventType, a5 as NotifyOnChangeProps, O as OmitKeyof, ac as Optional, y as Override, Z as PlaceholderDataFunction, _ as QueriesPlaceholderDataFunction, u as Query, Q as QueryCache, a as QueryCacheNotifyEvent, b as QueryClient, a$ as QueryClientConfig, j as QueryFilters, P as QueryFunction, X as QueryFunctionContext, A as QueryKey, $ as QueryKeyHashFunction, a3 as QueryMeta, c as QueryObserver, au as QueryObserverBaseResult, ax as QueryObserverLoadingErrorResult, aw as QueryObserverLoadingResult, aa as QueryObserverOptions, av as QueryObserverPendingResult, aA as QueryObserverPlaceholderResult, ay as QueryObserverRefetchErrorResult, aC as QueryObserverResult, az as QueryObserverSuccessResult, a6 as QueryOptions, W as QueryPersister, t as QueryState, as as QueryStatus, al as RefetchOptions, an as RefetchQueryFilters, R as Register, ap as ResetOptions, ak as ResultOptions, b2 as SetDataOptions, S as SkipToken, T as StaleTime, a9 as ThrowOnError, G as UnsetMarker, U as Updater, ab as WithRequired, E as dataTagErrorSymbol, B as dataTagSymbol, q as defaultShouldDehydrateMutation, p as defaultShouldDehydrateQuery, n as dehydrate, h as hashKey, o as hydrate, l as isCancelledError, i as isServer, k as keepPreviousData, f as matchMutation, m as matchQuery, r as replaceEqualDeep, s as skipToken, F as unsetMarker } from './hydration-CIqZ2rw6.cjs';
|
|
2
2
|
export { QueriesObserver, QueriesObserverOptions } from './queriesObserver.cjs';
|
|
3
3
|
export { InfiniteQueryObserver } from './infiniteQueryObserver.cjs';
|
|
4
|
-
export { notifyManager } from './notifyManager.cjs';
|
|
4
|
+
export { defaultScheduler, notifyManager } from './notifyManager.cjs';
|
|
5
5
|
export { focusManager } from './focusManager.cjs';
|
|
6
6
|
export { onlineManager } from './onlineManager.cjs';
|
|
7
7
|
export { streamedQuery as experimental_streamedQuery } from './streamedQuery.cjs';
|
package/build/modern/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { I as AnyDataTag, b1 as CancelOptions, C as CancelledError, J as DataTag, z as DefaultError, b0 as DefaultOptions, af as DefaultedInfiniteQueryObserverOptions, ad as DefaultedQueryObserverOptions, aK as DefinedInfiniteQueryObserverResult, aB as DefinedQueryObserverResult, D as DehydrateOptions, x as DehydratedState, V as Enabled, ai as EnsureInfiniteQueryDataOptions, ah as EnsureQueryDataOptions, aj as FetchInfiniteQueryOptions, aq as FetchNextPageOptions, ar as FetchPreviousPageOptions, ag as FetchQueryOptions, at as FetchStatus, a1 as GetNextPageParamFunction, a0 as GetPreviousPageParamFunction, H as HydrateOptions, K as InferDataFromTag, L as InferErrorFromTag, a2 as InfiniteData, aD as InfiniteQueryObserverBaseResult, aG as InfiniteQueryObserverLoadingErrorResult, aF as InfiniteQueryObserverLoadingResult, ae as InfiniteQueryObserverOptions, aE as InfiniteQueryObserverPendingResult, aJ as InfiniteQueryObserverPlaceholderResult, aH as InfiniteQueryObserverRefetchErrorResult, aL as InfiniteQueryObserverResult, aI as InfiniteQueryObserverSuccessResult, a8 as InfiniteQueryPageParamsOptions, Y as InitialDataFunction, a7 as InitialPageParam, ao as InvalidateOptions, am as InvalidateQueryFilters, aU as MutateFunction, aT as MutateOptions, w as Mutation, M as MutationCache, d as MutationCacheNotifyEvent, g as MutationFilters, aQ as MutationFunction, aM as MutationKey, aP as MutationMeta, e as MutationObserver, aV as MutationObserverBaseResult, aY as MutationObserverErrorResult, aW as MutationObserverIdleResult, aX as MutationObserverLoadingResult, aS as MutationObserverOptions, a_ as MutationObserverResult, aZ as MutationObserverSuccessResult, aR as MutationOptions, aO as MutationScope, v as MutationState, aN as MutationStatus, a4 as NetworkMode, N as NoInfer, b4 as NotifyEvent, b3 as NotifyEventType, a5 as NotifyOnChangeProps, O as OmitKeyof, ac as Optional, y as Override, Z as PlaceholderDataFunction, _ as QueriesPlaceholderDataFunction, u as Query, Q as QueryCache, a as QueryCacheNotifyEvent, b as QueryClient, a$ as QueryClientConfig, j as QueryFilters, P as QueryFunction, X as QueryFunctionContext, A as QueryKey, $ as QueryKeyHashFunction, a3 as QueryMeta, c as QueryObserver, au as QueryObserverBaseResult, ax as QueryObserverLoadingErrorResult, aw as QueryObserverLoadingResult, aa as QueryObserverOptions, av as QueryObserverPendingResult, aA as QueryObserverPlaceholderResult, ay as QueryObserverRefetchErrorResult, aC as QueryObserverResult, az as QueryObserverSuccessResult, a6 as QueryOptions, W as QueryPersister, t as QueryState, as as QueryStatus, al as RefetchOptions, an as RefetchQueryFilters, R as Register, ap as ResetOptions, ak as ResultOptions, b2 as SetDataOptions, S as SkipToken, T as StaleTime, a9 as ThrowOnError, G as UnsetMarker, U as Updater, ab as WithRequired, E as dataTagErrorSymbol, B as dataTagSymbol, q as defaultShouldDehydrateMutation, p as defaultShouldDehydrateQuery, n as dehydrate, h as hashKey, o as hydrate, l as isCancelledError, i as isServer, k as keepPreviousData, f as matchMutation, m as matchQuery, r as replaceEqualDeep, s as skipToken, F as unsetMarker } from './hydration-Cik0p0G0.js';
|
|
2
2
|
export { QueriesObserver, QueriesObserverOptions } from './queriesObserver.js';
|
|
3
3
|
export { InfiniteQueryObserver } from './infiniteQueryObserver.js';
|
|
4
|
-
export { notifyManager } from './notifyManager.js';
|
|
4
|
+
export { defaultScheduler, notifyManager } from './notifyManager.js';
|
|
5
5
|
export { focusManager } from './focusManager.js';
|
|
6
6
|
export { onlineManager } from './onlineManager.js';
|
|
7
7
|
export { streamedQuery as experimental_streamedQuery } from './streamedQuery.js';
|
package/build/modern/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { QueriesObserver } from "./queriesObserver.js";
|
|
|
7
7
|
import { InfiniteQueryObserver } from "./infiniteQueryObserver.js";
|
|
8
8
|
import { MutationCache } from "./mutationCache.js";
|
|
9
9
|
import { MutationObserver } from "./mutationObserver.js";
|
|
10
|
-
import { notifyManager } from "./notifyManager.js";
|
|
10
|
+
import { notifyManager, defaultScheduler } from "./notifyManager.js";
|
|
11
11
|
import { focusManager } from "./focusManager.js";
|
|
12
12
|
import { onlineManager } from "./onlineManager.js";
|
|
13
13
|
import {
|
|
@@ -41,6 +41,7 @@ export {
|
|
|
41
41
|
QueryCache,
|
|
42
42
|
QueryClient,
|
|
43
43
|
QueryObserver,
|
|
44
|
+
defaultScheduler,
|
|
44
45
|
defaultShouldDehydrateMutation,
|
|
45
46
|
defaultShouldDehydrateQuery,
|
|
46
47
|
dehydrate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\nexport { CancelledError } from './retryer'\nexport { QueryCache } from './queryCache'\nexport type { QueryCacheNotifyEvent } from './queryCache'\nexport { QueryClient } from './queryClient'\nexport { QueryObserver } from './queryObserver'\nexport { QueriesObserver } from './queriesObserver'\nexport { InfiniteQueryObserver } from './infiniteQueryObserver'\nexport { MutationCache } from './mutationCache'\nexport type { MutationCacheNotifyEvent } from './mutationCache'\nexport { MutationObserver } from './mutationObserver'\nexport { notifyManager } from './notifyManager'\nexport { focusManager } from './focusManager'\nexport { onlineManager } from './onlineManager'\nexport {\n hashKey,\n replaceEqualDeep,\n isServer,\n matchQuery,\n matchMutation,\n keepPreviousData,\n skipToken,\n} from './utils'\nexport type { MutationFilters, QueryFilters, Updater, SkipToken } from './utils'\nexport { isCancelledError } from './retryer'\nexport {\n dehydrate,\n hydrate,\n defaultShouldDehydrateQuery,\n defaultShouldDehydrateMutation,\n} from './hydration'\n\nexport { streamedQuery as experimental_streamedQuery } from './streamedQuery'\n\n// Types\nexport * from './types'\nexport type { QueryState } from './query'\nexport { Query } from './query'\nexport type { MutationState } from './mutation'\nexport { Mutation } from './mutation'\nexport type {\n DehydrateOptions,\n DehydratedState,\n HydrateOptions,\n} from './hydration'\nexport type { QueriesObserverOptions } from './queriesObserver'\n"],"mappings":";AAEA,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAE3B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAE9B,SAAS,wBAAwB;AACjC,SAAS,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\nexport { CancelledError } from './retryer'\nexport { QueryCache } from './queryCache'\nexport type { QueryCacheNotifyEvent } from './queryCache'\nexport { QueryClient } from './queryClient'\nexport { QueryObserver } from './queryObserver'\nexport { QueriesObserver } from './queriesObserver'\nexport { InfiniteQueryObserver } from './infiniteQueryObserver'\nexport { MutationCache } from './mutationCache'\nexport type { MutationCacheNotifyEvent } from './mutationCache'\nexport { MutationObserver } from './mutationObserver'\nexport { notifyManager, defaultScheduler } from './notifyManager'\nexport { focusManager } from './focusManager'\nexport { onlineManager } from './onlineManager'\nexport {\n hashKey,\n replaceEqualDeep,\n isServer,\n matchQuery,\n matchMutation,\n keepPreviousData,\n skipToken,\n} from './utils'\nexport type { MutationFilters, QueryFilters, Updater, SkipToken } from './utils'\nexport { isCancelledError } from './retryer'\nexport {\n dehydrate,\n hydrate,\n defaultShouldDehydrateQuery,\n defaultShouldDehydrateMutation,\n} from './hydration'\n\nexport { streamedQuery as experimental_streamedQuery } from './streamedQuery'\n\n// Types\nexport * from './types'\nexport type { QueryState } from './query'\nexport { Query } from './query'\nexport type { MutationState } from './mutation'\nexport { Mutation } from './mutation'\nexport type {\n DehydrateOptions,\n DehydratedState,\n HydrateOptions,\n} from './hydration'\nexport type { QueriesObserverOptions } from './queriesObserver'\n"],"mappings":";AAEA,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAE3B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAE9B,SAAS,wBAAwB;AACjC,SAAS,eAAe,wBAAwB;AAChD,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAA0B,qBAAkC;AAG5D,cAAc;AAEd,SAAS,aAAa;AAEtB,SAAS,gBAAgB;","names":[]}
|
|
@@ -21,9 +21,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var notifyManager_exports = {};
|
|
22
22
|
__export(notifyManager_exports, {
|
|
23
23
|
createNotifyManager: () => createNotifyManager,
|
|
24
|
+
defaultScheduler: () => defaultScheduler,
|
|
24
25
|
notifyManager: () => notifyManager
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(notifyManager_exports);
|
|
28
|
+
var defaultScheduler = (cb) => setTimeout(cb, 0);
|
|
27
29
|
function createNotifyManager() {
|
|
28
30
|
let queue = [];
|
|
29
31
|
let transactions = 0;
|
|
@@ -33,7 +35,7 @@ function createNotifyManager() {
|
|
|
33
35
|
let batchNotifyFn = (callback) => {
|
|
34
36
|
callback();
|
|
35
37
|
};
|
|
36
|
-
let scheduleFn =
|
|
38
|
+
let scheduleFn = defaultScheduler;
|
|
37
39
|
const schedule = (callback) => {
|
|
38
40
|
if (transactions) {
|
|
39
41
|
queue.push(callback);
|
|
@@ -104,6 +106,7 @@ var notifyManager = createNotifyManager();
|
|
|
104
106
|
// Annotate the CommonJS export names for ESM import in node:
|
|
105
107
|
0 && (module.exports = {
|
|
106
108
|
createNotifyManager,
|
|
109
|
+
defaultScheduler,
|
|
107
110
|
notifyManager
|
|
108
111
|
});
|
|
109
112
|
//# sourceMappingURL=notifyManager.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/notifyManager.ts"],"sourcesContent":["// TYPES\n\ntype NotifyCallback = () => void\n\ntype NotifyFunction = (callback: () => void) => void\n\ntype BatchNotifyFunction = (callback: () => void) => void\n\ntype BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void\n\ntype ScheduleFunction = (callback: () => void) => void\n\nexport function createNotifyManager() {\n let queue: Array<NotifyCallback> = []\n let transactions = 0\n let notifyFn: NotifyFunction = (callback) => {\n callback()\n }\n let batchNotifyFn: BatchNotifyFunction = (callback: () => void) => {\n callback()\n }\n let scheduleFn
|
|
1
|
+
{"version":3,"sources":["../../src/notifyManager.ts"],"sourcesContent":["// TYPES\n\ntype NotifyCallback = () => void\n\ntype NotifyFunction = (callback: () => void) => void\n\ntype BatchNotifyFunction = (callback: () => void) => void\n\ntype BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void\n\ntype ScheduleFunction = (callback: () => void) => void\n\nexport const defaultScheduler: ScheduleFunction = (cb) => setTimeout(cb, 0)\n\nexport function createNotifyManager() {\n let queue: Array<NotifyCallback> = []\n let transactions = 0\n let notifyFn: NotifyFunction = (callback) => {\n callback()\n }\n let batchNotifyFn: BatchNotifyFunction = (callback: () => void) => {\n callback()\n }\n let scheduleFn = defaultScheduler\n\n const schedule = (callback: NotifyCallback): void => {\n if (transactions) {\n queue.push(callback)\n } else {\n scheduleFn(() => {\n notifyFn(callback)\n })\n }\n }\n const flush = (): void => {\n const originalQueue = queue\n queue = []\n if (originalQueue.length) {\n scheduleFn(() => {\n batchNotifyFn(() => {\n originalQueue.forEach((callback) => {\n notifyFn(callback)\n })\n })\n })\n }\n }\n\n return {\n batch: <T>(callback: () => T): T => {\n let result\n transactions++\n try {\n result = callback()\n } finally {\n transactions--\n if (!transactions) {\n flush()\n }\n }\n return result\n },\n /**\n * All calls to the wrapped function will be batched.\n */\n batchCalls: <T extends Array<unknown>>(\n callback: BatchCallsCallback<T>,\n ): BatchCallsCallback<T> => {\n return (...args) => {\n schedule(() => {\n callback(...args)\n })\n }\n },\n schedule,\n /**\n * Use this method to set a custom notify function.\n * This can be used to for example wrap notifications with `React.act` while running tests.\n */\n setNotifyFunction: (fn: NotifyFunction) => {\n notifyFn = fn\n },\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n setBatchNotifyFunction: (fn: BatchNotifyFunction) => {\n batchNotifyFn = fn\n },\n setScheduler: (fn: ScheduleFunction) => {\n scheduleFn = fn\n },\n } as const\n}\n\n// SINGLETON\nexport const notifyManager = createNotifyManager()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,IAAM,mBAAqC,CAAC,OAAO,WAAW,IAAI,CAAC;AAEnE,SAAS,sBAAsB;AACpC,MAAI,QAA+B,CAAC;AACpC,MAAI,eAAe;AACnB,MAAI,WAA2B,CAAC,aAAa;AAC3C,aAAS;AAAA,EACX;AACA,MAAI,gBAAqC,CAAC,aAAyB;AACjE,aAAS;AAAA,EACX;AACA,MAAI,aAAa;AAEjB,QAAM,WAAW,CAAC,aAAmC;AACnD,QAAI,cAAc;AAChB,YAAM,KAAK,QAAQ;AAAA,IACrB,OAAO;AACL,iBAAW,MAAM;AACf,iBAAS,QAAQ;AAAA,MACnB,CAAC;AAAA,IACH;AAAA,EACF;AACA,QAAM,QAAQ,MAAY;AACxB,UAAM,gBAAgB;AACtB,YAAQ,CAAC;AACT,QAAI,cAAc,QAAQ;AACxB,iBAAW,MAAM;AACf,sBAAc,MAAM;AAClB,wBAAc,QAAQ,CAAC,aAAa;AAClC,qBAAS,QAAQ;AAAA,UACnB,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO,CAAI,aAAyB;AAClC,UAAI;AACJ;AACA,UAAI;AACF,iBAAS,SAAS;AAAA,MACpB,UAAE;AACA;AACA,YAAI,CAAC,cAAc;AACjB,gBAAM;AAAA,QACR;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA;AAAA;AAAA;AAAA,IAIA,YAAY,CACV,aAC0B;AAC1B,aAAO,IAAI,SAAS;AAClB,iBAAS,MAAM;AACb,mBAAS,GAAG,IAAI;AAAA,QAClB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,mBAAmB,CAAC,OAAuB;AACzC,iBAAW;AAAA,IACb;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,wBAAwB,CAAC,OAA4B;AACnD,sBAAgB;AAAA,IAClB;AAAA,IACA,cAAc,CAAC,OAAyB;AACtC,mBAAa;AAAA,IACf;AAAA,EACF;AACF;AAGO,IAAM,gBAAgB,oBAAoB;","names":[]}
|
|
@@ -3,6 +3,7 @@ type NotifyFunction = (callback: () => void) => void;
|
|
|
3
3
|
type BatchNotifyFunction = (callback: () => void) => void;
|
|
4
4
|
type BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void;
|
|
5
5
|
type ScheduleFunction = (callback: () => void) => void;
|
|
6
|
+
declare const defaultScheduler: ScheduleFunction;
|
|
6
7
|
declare function createNotifyManager(): {
|
|
7
8
|
readonly batch: <T>(callback: () => T) => T;
|
|
8
9
|
/**
|
|
@@ -42,4 +43,4 @@ declare const notifyManager: {
|
|
|
42
43
|
readonly setScheduler: (fn: ScheduleFunction) => void;
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
export { createNotifyManager, notifyManager };
|
|
46
|
+
export { createNotifyManager, defaultScheduler, notifyManager };
|
|
@@ -3,6 +3,7 @@ type NotifyFunction = (callback: () => void) => void;
|
|
|
3
3
|
type BatchNotifyFunction = (callback: () => void) => void;
|
|
4
4
|
type BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void;
|
|
5
5
|
type ScheduleFunction = (callback: () => void) => void;
|
|
6
|
+
declare const defaultScheduler: ScheduleFunction;
|
|
6
7
|
declare function createNotifyManager(): {
|
|
7
8
|
readonly batch: <T>(callback: () => T) => T;
|
|
8
9
|
/**
|
|
@@ -42,4 +43,4 @@ declare const notifyManager: {
|
|
|
42
43
|
readonly setScheduler: (fn: ScheduleFunction) => void;
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
export { createNotifyManager, notifyManager };
|
|
46
|
+
export { createNotifyManager, defaultScheduler, notifyManager };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/notifyManager.ts
|
|
2
|
+
var defaultScheduler = (cb) => setTimeout(cb, 0);
|
|
2
3
|
function createNotifyManager() {
|
|
3
4
|
let queue = [];
|
|
4
5
|
let transactions = 0;
|
|
@@ -8,7 +9,7 @@ function createNotifyManager() {
|
|
|
8
9
|
let batchNotifyFn = (callback) => {
|
|
9
10
|
callback();
|
|
10
11
|
};
|
|
11
|
-
let scheduleFn =
|
|
12
|
+
let scheduleFn = defaultScheduler;
|
|
12
13
|
const schedule = (callback) => {
|
|
13
14
|
if (transactions) {
|
|
14
15
|
queue.push(callback);
|
|
@@ -78,6 +79,7 @@ function createNotifyManager() {
|
|
|
78
79
|
var notifyManager = createNotifyManager();
|
|
79
80
|
export {
|
|
80
81
|
createNotifyManager,
|
|
82
|
+
defaultScheduler,
|
|
81
83
|
notifyManager
|
|
82
84
|
};
|
|
83
85
|
//# sourceMappingURL=notifyManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/notifyManager.ts"],"sourcesContent":["// TYPES\n\ntype NotifyCallback = () => void\n\ntype NotifyFunction = (callback: () => void) => void\n\ntype BatchNotifyFunction = (callback: () => void) => void\n\ntype BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void\n\ntype ScheduleFunction = (callback: () => void) => void\n\nexport function createNotifyManager() {\n let queue: Array<NotifyCallback> = []\n let transactions = 0\n let notifyFn: NotifyFunction = (callback) => {\n callback()\n }\n let batchNotifyFn: BatchNotifyFunction = (callback: () => void) => {\n callback()\n }\n let scheduleFn
|
|
1
|
+
{"version":3,"sources":["../../src/notifyManager.ts"],"sourcesContent":["// TYPES\n\ntype NotifyCallback = () => void\n\ntype NotifyFunction = (callback: () => void) => void\n\ntype BatchNotifyFunction = (callback: () => void) => void\n\ntype BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void\n\ntype ScheduleFunction = (callback: () => void) => void\n\nexport const defaultScheduler: ScheduleFunction = (cb) => setTimeout(cb, 0)\n\nexport function createNotifyManager() {\n let queue: Array<NotifyCallback> = []\n let transactions = 0\n let notifyFn: NotifyFunction = (callback) => {\n callback()\n }\n let batchNotifyFn: BatchNotifyFunction = (callback: () => void) => {\n callback()\n }\n let scheduleFn = defaultScheduler\n\n const schedule = (callback: NotifyCallback): void => {\n if (transactions) {\n queue.push(callback)\n } else {\n scheduleFn(() => {\n notifyFn(callback)\n })\n }\n }\n const flush = (): void => {\n const originalQueue = queue\n queue = []\n if (originalQueue.length) {\n scheduleFn(() => {\n batchNotifyFn(() => {\n originalQueue.forEach((callback) => {\n notifyFn(callback)\n })\n })\n })\n }\n }\n\n return {\n batch: <T>(callback: () => T): T => {\n let result\n transactions++\n try {\n result = callback()\n } finally {\n transactions--\n if (!transactions) {\n flush()\n }\n }\n return result\n },\n /**\n * All calls to the wrapped function will be batched.\n */\n batchCalls: <T extends Array<unknown>>(\n callback: BatchCallsCallback<T>,\n ): BatchCallsCallback<T> => {\n return (...args) => {\n schedule(() => {\n callback(...args)\n })\n }\n },\n schedule,\n /**\n * Use this method to set a custom notify function.\n * This can be used to for example wrap notifications with `React.act` while running tests.\n */\n setNotifyFunction: (fn: NotifyFunction) => {\n notifyFn = fn\n },\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n setBatchNotifyFunction: (fn: BatchNotifyFunction) => {\n batchNotifyFn = fn\n },\n setScheduler: (fn: ScheduleFunction) => {\n scheduleFn = fn\n },\n } as const\n}\n\n// SINGLETON\nexport const notifyManager = createNotifyManager()\n"],"mappings":";AAYO,IAAM,mBAAqC,CAAC,OAAO,WAAW,IAAI,CAAC;AAEnE,SAAS,sBAAsB;AACpC,MAAI,QAA+B,CAAC;AACpC,MAAI,eAAe;AACnB,MAAI,WAA2B,CAAC,aAAa;AAC3C,aAAS;AAAA,EACX;AACA,MAAI,gBAAqC,CAAC,aAAyB;AACjE,aAAS;AAAA,EACX;AACA,MAAI,aAAa;AAEjB,QAAM,WAAW,CAAC,aAAmC;AACnD,QAAI,cAAc;AAChB,YAAM,KAAK,QAAQ;AAAA,IACrB,OAAO;AACL,iBAAW,MAAM;AACf,iBAAS,QAAQ;AAAA,MACnB,CAAC;AAAA,IACH;AAAA,EACF;AACA,QAAM,QAAQ,MAAY;AACxB,UAAM,gBAAgB;AACtB,YAAQ,CAAC;AACT,QAAI,cAAc,QAAQ;AACxB,iBAAW,MAAM;AACf,sBAAc,MAAM;AAClB,wBAAc,QAAQ,CAAC,aAAa;AAClC,qBAAS,QAAQ;AAAA,UACnB,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO,CAAI,aAAyB;AAClC,UAAI;AACJ;AACA,UAAI;AACF,iBAAS,SAAS;AAAA,MACpB,UAAE;AACA;AACA,YAAI,CAAC,cAAc;AACjB,gBAAM;AAAA,QACR;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA;AAAA;AAAA;AAAA,IAIA,YAAY,CACV,aAC0B;AAC1B,aAAO,IAAI,SAAS;AAClB,iBAAS,MAAM;AACb,mBAAS,GAAG,IAAI;AAAA,QAClB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,mBAAmB,CAAC,OAAuB;AACzC,iBAAW;AAAA,IACb;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,wBAAwB,CAAC,OAA4B;AACnD,sBAAgB;AAAA,IAClB;AAAA,IACA,cAAc,CAAC,OAAyB;AACtC,mBAAa;AAAA,IACf;AAAA,EACF;AACF;AAGO,IAAM,gBAAgB,oBAAoB;","names":[]}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { InfiniteQueryObserver } from './infiniteQueryObserver'
|
|
|
10
10
|
export { MutationCache } from './mutationCache'
|
|
11
11
|
export type { MutationCacheNotifyEvent } from './mutationCache'
|
|
12
12
|
export { MutationObserver } from './mutationObserver'
|
|
13
|
-
export { notifyManager } from './notifyManager'
|
|
13
|
+
export { notifyManager, defaultScheduler } from './notifyManager'
|
|
14
14
|
export { focusManager } from './focusManager'
|
|
15
15
|
export { onlineManager } from './onlineManager'
|
|
16
16
|
export {
|
package/src/notifyManager.ts
CHANGED
|
@@ -10,6 +10,8 @@ type BatchCallsCallback<T extends Array<unknown>> = (...args: T) => void
|
|
|
10
10
|
|
|
11
11
|
type ScheduleFunction = (callback: () => void) => void
|
|
12
12
|
|
|
13
|
+
export const defaultScheduler: ScheduleFunction = (cb) => setTimeout(cb, 0)
|
|
14
|
+
|
|
13
15
|
export function createNotifyManager() {
|
|
14
16
|
let queue: Array<NotifyCallback> = []
|
|
15
17
|
let transactions = 0
|
|
@@ -19,7 +21,7 @@ export function createNotifyManager() {
|
|
|
19
21
|
let batchNotifyFn: BatchNotifyFunction = (callback: () => void) => {
|
|
20
22
|
callback()
|
|
21
23
|
}
|
|
22
|
-
let scheduleFn
|
|
24
|
+
let scheduleFn = defaultScheduler
|
|
23
25
|
|
|
24
26
|
const schedule = (callback: NotifyCallback): void => {
|
|
25
27
|
if (transactions) {
|