@tanstack/react-query 4.42.1 → 4.43.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.
Files changed (38) hide show
  1. package/build/lib/__tests__/usePrefetchInfiniteQuery.types.test.d.ts +2 -0
  2. package/build/lib/__tests__/usePrefetchInfiniteQuery.types.test.d.ts.map +1 -0
  3. package/build/lib/__tests__/usePrefetchQuery.types.test.d.ts +2 -0
  4. package/build/lib/__tests__/usePrefetchQuery.types.test.d.ts.map +1 -0
  5. package/build/lib/index.d.ts +2 -0
  6. package/build/lib/index.d.ts.map +1 -1
  7. package/build/lib/index.esm.js +2 -0
  8. package/build/lib/index.esm.js.map +1 -1
  9. package/build/lib/index.js +4 -0
  10. package/build/lib/index.js.map +1 -1
  11. package/build/lib/index.mjs +2 -0
  12. package/build/lib/index.mjs.map +1 -1
  13. package/build/lib/usePrefetchInfiniteQuery.d.ts +3 -0
  14. package/build/lib/usePrefetchInfiniteQuery.d.ts.map +1 -0
  15. package/build/lib/usePrefetchInfiniteQuery.esm.js +12 -0
  16. package/build/lib/usePrefetchInfiniteQuery.esm.js.map +1 -0
  17. package/build/lib/usePrefetchInfiniteQuery.js +16 -0
  18. package/build/lib/usePrefetchInfiniteQuery.js.map +1 -0
  19. package/build/lib/usePrefetchInfiniteQuery.mjs +12 -0
  20. package/build/lib/usePrefetchInfiniteQuery.mjs.map +1 -0
  21. package/build/lib/usePrefetchQuery.d.ts +3 -0
  22. package/build/lib/usePrefetchQuery.d.ts.map +1 -0
  23. package/build/lib/usePrefetchQuery.esm.js +12 -0
  24. package/build/lib/usePrefetchQuery.esm.js.map +1 -0
  25. package/build/lib/usePrefetchQuery.js +16 -0
  26. package/build/lib/usePrefetchQuery.js.map +1 -0
  27. package/build/lib/usePrefetchQuery.mjs +12 -0
  28. package/build/lib/usePrefetchQuery.mjs.map +1 -0
  29. package/build/umd/index.development.js +96 -221
  30. package/build/umd/index.development.js.map +1 -1
  31. package/build/umd/index.production.js +1 -1
  32. package/build/umd/index.production.js.map +1 -1
  33. package/package.json +4 -4
  34. package/src/__tests__/usePrefetchInfiniteQuery.types.test.tsx +45 -0
  35. package/src/__tests__/usePrefetchQuery.types.test.tsx +56 -0
  36. package/src/index.ts +2 -0
  37. package/src/usePrefetchInfiniteQuery.ts +23 -0
  38. package/src/usePrefetchQuery.ts +23 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=usePrefetchInfiniteQuery.types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrefetchInfiniteQuery.types.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/usePrefetchInfiniteQuery.types.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=usePrefetchQuery.types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrefetchQuery.types.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/usePrefetchQuery.types.test.tsx"],"names":[],"mappings":""}
@@ -23,4 +23,6 @@ export { useIsMutating } from './useIsMutating';
23
23
  export { useMutation } from './useMutation';
24
24
  export { useInfiniteQuery } from './useInfiniteQuery';
25
25
  export { useIsRestoring, IsRestoringProvider } from './isRestoring';
26
+ export { usePrefetchQuery } from './usePrefetchQuery';
27
+ export { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery';
26
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,qBAAqB,CAAA;AAG5B,cAAc,sBAAsB,CAAA;AAGpC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,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,eAAe,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA"}
@@ -15,4 +15,6 @@ export { useIsMutating } from './useIsMutating.esm.js';
15
15
  export { useMutation } from './useMutation.esm.js';
16
16
  export { useInfiniteQuery } from './useInfiniteQuery.esm.js';
17
17
  export { IsRestoringProvider, useIsRestoring } from './isRestoring.esm.js';
18
+ export { usePrefetchQuery } from './usePrefetchQuery.esm.js';
19
+ export { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery.esm.js';
18
20
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
@@ -19,6 +19,8 @@ var useIsMutating = require('./useIsMutating.js');
19
19
  var useMutation = require('./useMutation.js');
20
20
  var useInfiniteQuery = require('./useInfiniteQuery.js');
21
21
  var isRestoring = require('./isRestoring.js');
22
+ var usePrefetchQuery = require('./usePrefetchQuery.js');
23
+ var usePrefetchInfiniteQuery = require('./usePrefetchInfiniteQuery.js');
22
24
 
23
25
 
24
26
 
@@ -42,6 +44,8 @@ exports.useMutation = useMutation.useMutation;
42
44
  exports.useInfiniteQuery = useInfiniteQuery.useInfiniteQuery;
43
45
  exports.IsRestoringProvider = isRestoring.IsRestoringProvider;
44
46
  exports.useIsRestoring = isRestoring.useIsRestoring;
47
+ exports.usePrefetchQuery = usePrefetchQuery.usePrefetchQuery;
48
+ exports.usePrefetchInfiniteQuery = usePrefetchInfiniteQuery.usePrefetchInfiniteQuery;
45
49
  Object.keys(queryCore).forEach(function (k) {
46
50
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
47
51
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -15,4 +15,6 @@ export { useIsMutating } from './useIsMutating.mjs';
15
15
  export { useMutation } from './useMutation.mjs';
16
16
  export { useInfiniteQuery } from './useInfiniteQuery.mjs';
17
17
  export { IsRestoringProvider, useIsRestoring } from './isRestoring.mjs';
18
+ export { usePrefetchQuery } from './usePrefetchQuery.mjs';
19
+ export { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery.mjs';
18
20
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ import type { FetchInfiniteQueryOptions, QueryKey, WithRequired } from '@tanstack/query-core';
2
+ export declare function usePrefetchInfiniteQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: WithRequired<FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryKey'>): void;
3
+ //# sourceMappingURL=usePrefetchInfiniteQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrefetchInfiniteQuery.d.ts","sourceRoot":"","sources":["../../src/usePrefetchInfiniteQuery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,yBAAyB,EACzB,QAAQ,EACR,YAAY,EACb,MAAM,sBAAsB,CAAA;AAE7B,wBAAgB,wBAAwB,CACtC,YAAY,GAAG,OAAO,EACtB,MAAM,GAAG,OAAO,EAChB,KAAK,GAAG,YAAY,EACpB,SAAS,SAAS,QAAQ,GAAG,QAAQ,EAErC,OAAO,EAAE,YAAY,CACnB,yBAAyB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,EACjE,UAAU,CACX,QAMF"}
@@ -0,0 +1,12 @@
1
+ import { useQueryClient } from './QueryClientProvider.esm.js';
2
+
3
+ function usePrefetchInfiniteQuery(options) {
4
+ const client = useQueryClient();
5
+
6
+ if (!client.getQueryState(options.queryKey)) {
7
+ client.prefetchInfiniteQuery(options);
8
+ }
9
+ }
10
+
11
+ export { usePrefetchInfiniteQuery };
12
+ //# sourceMappingURL=usePrefetchInfiniteQuery.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrefetchInfiniteQuery.esm.js","sources":["../../src/usePrefetchInfiniteQuery.ts"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type {\n FetchInfiniteQueryOptions,\n QueryKey,\n WithRequired,\n} from '@tanstack/query-core'\n\nexport function usePrefetchInfiniteQuery<\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: WithRequired<\n FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryKey'\n >,\n) {\n const client = useQueryClient()\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchInfiniteQuery(options)\n }\n}\n"],"names":["usePrefetchInfiniteQuery","options","client","useQueryClient","getQueryState","queryKey","prefetchInfiniteQuery"],"mappings":";;AAOO,SAASA,wBAAT,CAMLC,OANK,EAUL;EACA,MAAMC,MAAM,GAAGC,cAAc,EAA7B,CAAA;;EACA,IAAI,CAACD,MAAM,CAACE,aAAP,CAAqBH,OAAO,CAACI,QAA7B,CAAL,EAA6C;IAC3CH,MAAM,CAACI,qBAAP,CAA6BL,OAA7B,CAAA,CAAA;AACD,GAAA;AACF;;;;"}
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var QueryClientProvider = require('./QueryClientProvider.js');
6
+
7
+ function usePrefetchInfiniteQuery(options) {
8
+ const client = QueryClientProvider.useQueryClient();
9
+
10
+ if (!client.getQueryState(options.queryKey)) {
11
+ client.prefetchInfiniteQuery(options);
12
+ }
13
+ }
14
+
15
+ exports.usePrefetchInfiniteQuery = usePrefetchInfiniteQuery;
16
+ //# sourceMappingURL=usePrefetchInfiniteQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrefetchInfiniteQuery.js","sources":["../../src/usePrefetchInfiniteQuery.ts"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type {\n FetchInfiniteQueryOptions,\n QueryKey,\n WithRequired,\n} from '@tanstack/query-core'\n\nexport function usePrefetchInfiniteQuery<\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: WithRequired<\n FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryKey'\n >,\n) {\n const client = useQueryClient()\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchInfiniteQuery(options)\n }\n}\n"],"names":["usePrefetchInfiniteQuery","options","client","useQueryClient","getQueryState","queryKey","prefetchInfiniteQuery"],"mappings":";;;;;;AAOO,SAASA,wBAAT,CAMLC,OANK,EAUL;EACA,MAAMC,MAAM,GAAGC,kCAAc,EAA7B,CAAA;;EACA,IAAI,CAACD,MAAM,CAACE,aAAP,CAAqBH,OAAO,CAACI,QAA7B,CAAL,EAA6C;IAC3CH,MAAM,CAACI,qBAAP,CAA6BL,OAA7B,CAAA,CAAA;AACD,GAAA;AACF;;;;"}
@@ -0,0 +1,12 @@
1
+ import { useQueryClient } from './QueryClientProvider.mjs';
2
+
3
+ function usePrefetchInfiniteQuery(options) {
4
+ const client = useQueryClient();
5
+
6
+ if (!client.getQueryState(options.queryKey)) {
7
+ client.prefetchInfiniteQuery(options);
8
+ }
9
+ }
10
+
11
+ export { usePrefetchInfiniteQuery };
12
+ //# sourceMappingURL=usePrefetchInfiniteQuery.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrefetchInfiniteQuery.mjs","sources":["../../src/usePrefetchInfiniteQuery.ts"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type {\n FetchInfiniteQueryOptions,\n QueryKey,\n WithRequired,\n} from '@tanstack/query-core'\n\nexport function usePrefetchInfiniteQuery<\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: WithRequired<\n FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryKey'\n >,\n) {\n const client = useQueryClient()\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchInfiniteQuery(options)\n }\n}\n"],"names":["usePrefetchInfiniteQuery","options","client","useQueryClient","getQueryState","queryKey","prefetchInfiniteQuery"],"mappings":";;AAOO,SAASA,wBAAT,CAMLC,OANK,EAUL;EACA,MAAMC,MAAM,GAAGC,cAAc,EAA7B,CAAA;;EACA,IAAI,CAACD,MAAM,CAACE,aAAP,CAAqBH,OAAO,CAACI,QAA7B,CAAL,EAA6C;IAC3CH,MAAM,CAACI,qBAAP,CAA6BL,OAA7B,CAAA,CAAA;AACD,GAAA;AACF;;;;"}
@@ -0,0 +1,3 @@
1
+ import type { FetchQueryOptions, QueryKey, WithRequired } from '@tanstack/query-core';
2
+ export declare function usePrefetchQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: WithRequired<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryKey'>): void;
3
+ //# sourceMappingURL=usePrefetchQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrefetchQuery.d.ts","sourceRoot":"","sources":["../../src/usePrefetchQuery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACb,MAAM,sBAAsB,CAAA;AAE7B,wBAAgB,gBAAgB,CAC9B,YAAY,GAAG,OAAO,EACtB,MAAM,GAAG,OAAO,EAChB,KAAK,GAAG,YAAY,EACpB,SAAS,SAAS,QAAQ,GAAG,QAAQ,EAErC,OAAO,EAAE,YAAY,CACnB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,EACzD,UAAU,CACX,QAMF"}
@@ -0,0 +1,12 @@
1
+ import { useQueryClient } from './QueryClientProvider.esm.js';
2
+
3
+ function usePrefetchQuery(options) {
4
+ const client = useQueryClient();
5
+
6
+ if (!client.getQueryState(options.queryKey)) {
7
+ client.prefetchQuery(options);
8
+ }
9
+ }
10
+
11
+ export { usePrefetchQuery };
12
+ //# sourceMappingURL=usePrefetchQuery.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrefetchQuery.esm.js","sources":["../../src/usePrefetchQuery.ts"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type {\n FetchQueryOptions,\n QueryKey,\n WithRequired,\n} from '@tanstack/query-core'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: WithRequired<\n FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryKey'\n >,\n) {\n const client = useQueryClient()\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchQuery(options)\n }\n}\n"],"names":["usePrefetchQuery","options","client","useQueryClient","getQueryState","queryKey","prefetchQuery"],"mappings":";;AAOO,SAASA,gBAAT,CAMLC,OANK,EAUL;EACA,MAAMC,MAAM,GAAGC,cAAc,EAA7B,CAAA;;EACA,IAAI,CAACD,MAAM,CAACE,aAAP,CAAqBH,OAAO,CAACI,QAA7B,CAAL,EAA6C;IAC3CH,MAAM,CAACI,aAAP,CAAqBL,OAArB,CAAA,CAAA;AACD,GAAA;AACF;;;;"}
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var QueryClientProvider = require('./QueryClientProvider.js');
6
+
7
+ function usePrefetchQuery(options) {
8
+ const client = QueryClientProvider.useQueryClient();
9
+
10
+ if (!client.getQueryState(options.queryKey)) {
11
+ client.prefetchQuery(options);
12
+ }
13
+ }
14
+
15
+ exports.usePrefetchQuery = usePrefetchQuery;
16
+ //# sourceMappingURL=usePrefetchQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrefetchQuery.js","sources":["../../src/usePrefetchQuery.ts"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type {\n FetchQueryOptions,\n QueryKey,\n WithRequired,\n} from '@tanstack/query-core'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: WithRequired<\n FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryKey'\n >,\n) {\n const client = useQueryClient()\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchQuery(options)\n }\n}\n"],"names":["usePrefetchQuery","options","client","useQueryClient","getQueryState","queryKey","prefetchQuery"],"mappings":";;;;;;AAOO,SAASA,gBAAT,CAMLC,OANK,EAUL;EACA,MAAMC,MAAM,GAAGC,kCAAc,EAA7B,CAAA;;EACA,IAAI,CAACD,MAAM,CAACE,aAAP,CAAqBH,OAAO,CAACI,QAA7B,CAAL,EAA6C;IAC3CH,MAAM,CAACI,aAAP,CAAqBL,OAArB,CAAA,CAAA;AACD,GAAA;AACF;;;;"}
@@ -0,0 +1,12 @@
1
+ import { useQueryClient } from './QueryClientProvider.mjs';
2
+
3
+ function usePrefetchQuery(options) {
4
+ const client = useQueryClient();
5
+
6
+ if (!client.getQueryState(options.queryKey)) {
7
+ client.prefetchQuery(options);
8
+ }
9
+ }
10
+
11
+ export { usePrefetchQuery };
12
+ //# sourceMappingURL=usePrefetchQuery.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrefetchQuery.mjs","sources":["../../src/usePrefetchQuery.ts"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type {\n FetchQueryOptions,\n QueryKey,\n WithRequired,\n} from '@tanstack/query-core'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: WithRequired<\n FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryKey'\n >,\n) {\n const client = useQueryClient()\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchQuery(options)\n }\n}\n"],"names":["usePrefetchQuery","options","client","useQueryClient","getQueryState","queryKey","prefetchQuery"],"mappings":";;AAOO,SAASA,gBAAT,CAMLC,OANK,EAUL;EACA,MAAMC,MAAM,GAAGC,cAAc,EAA7B,CAAA;;EACA,IAAI,CAACD,MAAM,CAACE,aAAP,CAAqBH,OAAO,CAACI,QAA7B,CAAL,EAA6C;IAC3CH,MAAM,CAACI,aAAP,CAAqBL,OAArB,CAAA,CAAA;AACD,GAAA;AACF;;;;"}
@@ -3365,7 +3365,7 @@
3365
3365
  * @license React
3366
3366
  * use-sync-external-store-shim.development.js
3367
3367
  *
3368
- * Copyright (c) Facebook, Inc. and its affiliates.
3368
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3369
3369
  *
3370
3370
  * This source code is licensed under the MIT license found in the
3371
3371
  * LICENSE file in the root directory of this source tree.
@@ -3376,232 +3376,89 @@
3376
3376
  function requireUseSyncExternalStoreShim_development () {
3377
3377
  if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
3378
3378
  hasRequiredUseSyncExternalStoreShim_development = 1;
3379
-
3380
- {
3381
- (function() {
3382
-
3383
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
3384
- if (
3385
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
3386
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
3387
- 'function'
3388
- ) {
3389
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
3390
- }
3391
- var React = React__default["default"];
3392
-
3393
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
3394
-
3395
- function error(format) {
3396
- {
3397
- {
3398
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
3399
- args[_key2 - 1] = arguments[_key2];
3400
- }
3401
-
3402
- printWarning('error', format, args);
3379
+ ((function () {
3380
+ function is(x, y) {
3381
+ return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
3403
3382
  }
3404
- }
3405
- }
3406
-
3407
- function printWarning(level, format, args) {
3408
- // When changing this logic, you might want to also
3409
- // update consoleWithStackDev.www.js as well.
3410
- {
3411
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
3412
- var stack = ReactDebugCurrentFrame.getStackAddendum();
3413
-
3414
- if (stack !== '') {
3415
- format += '%s';
3416
- args = args.concat([stack]);
3417
- } // eslint-disable-next-line react-internal/safe-string-coercion
3418
-
3419
-
3420
- var argsWithFormat = args.map(function (item) {
3421
- return String(item);
3422
- }); // Careful: RN currently depends on this prefix
3423
-
3424
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
3425
- // breaks IE9: https://github.com/facebook/react/issues/13610
3426
- // eslint-disable-next-line react-internal/no-production-logging
3427
-
3428
- Function.prototype.apply.call(console[level], console, argsWithFormat);
3429
- }
3430
- }
3431
-
3432
- /**
3433
- * inlined Object.is polyfill to avoid requiring consumers ship their own
3434
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
3435
- */
3436
- function is(x, y) {
3437
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
3438
- ;
3439
- }
3440
-
3441
- var objectIs = typeof Object.is === 'function' ? Object.is : is;
3442
-
3443
- // dispatch for CommonJS interop named imports.
3444
-
3445
- var useState = React.useState,
3446
- useEffect = React.useEffect,
3447
- useLayoutEffect = React.useLayoutEffect,
3448
- useDebugValue = React.useDebugValue;
3449
- var didWarnOld18Alpha = false;
3450
- var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
3451
- // because of a very particular set of implementation details and assumptions
3452
- // -- change any one of them and it will break. The most important assumption
3453
- // is that updates are always synchronous, because concurrent rendering is
3454
- // only available in versions of React that also have a built-in
3455
- // useSyncExternalStore API. And we only use this shim when the built-in API
3456
- // does not exist.
3457
- //
3458
- // Do not assume that the clever hacks used by this hook also work in general.
3459
- // The point of this shim is to replace the need for hacks by other libraries.
3460
-
3461
- function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
3462
- // React do not expose a way to check if we're hydrating. So users of the shim
3463
- // will need to track that themselves and return the correct value
3464
- // from `getSnapshot`.
3465
- getServerSnapshot) {
3466
- {
3467
- if (!didWarnOld18Alpha) {
3468
- if (React.startTransition !== undefined) {
3469
- didWarnOld18Alpha = true;
3470
-
3471
- error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');
3383
+ function useSyncExternalStore$2(subscribe, getSnapshot) {
3384
+ didWarnOld18Alpha ||
3385
+ void 0 === React.startTransition ||
3386
+ ((didWarnOld18Alpha = !0),
3387
+ console.error(
3388
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
3389
+ ));
3390
+ var value = getSnapshot();
3391
+ if (!didWarnUncachedGetSnapshot) {
3392
+ var cachedValue = getSnapshot();
3393
+ objectIs(value, cachedValue) ||
3394
+ (console.error(
3395
+ "The result of getSnapshot should be cached to avoid an infinite loop"
3396
+ ),
3397
+ (didWarnUncachedGetSnapshot = !0));
3472
3398
  }
3399
+ cachedValue = useState({
3400
+ inst: { value: value, getSnapshot: getSnapshot }
3401
+ });
3402
+ var inst = cachedValue[0].inst,
3403
+ forceUpdate = cachedValue[1];
3404
+ useLayoutEffect(
3405
+ function () {
3406
+ inst.value = value;
3407
+ inst.getSnapshot = getSnapshot;
3408
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
3409
+ },
3410
+ [subscribe, value, getSnapshot]
3411
+ );
3412
+ useEffect(
3413
+ function () {
3414
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
3415
+ return subscribe(function () {
3416
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
3417
+ });
3418
+ },
3419
+ [subscribe]
3420
+ );
3421
+ useDebugValue(value);
3422
+ return value;
3473
3423
  }
3474
- } // Read the current snapshot from the store on every render. Again, this
3475
- // breaks the rules of React, and only works here because of specific
3476
- // implementation details, most importantly that updates are
3477
- // always synchronous.
3478
-
3479
-
3480
- var value = getSnapshot();
3481
-
3482
- {
3483
- if (!didWarnUncachedGetSnapshot) {
3484
- var cachedValue = getSnapshot();
3485
-
3486
- if (!objectIs(value, cachedValue)) {
3487
- error('The result of getSnapshot should be cached to avoid an infinite loop');
3488
-
3489
- didWarnUncachedGetSnapshot = true;
3424
+ function checkIfSnapshotChanged(inst) {
3425
+ var latestGetSnapshot = inst.getSnapshot;
3426
+ inst = inst.value;
3427
+ try {
3428
+ var nextValue = latestGetSnapshot();
3429
+ return !objectIs(inst, nextValue);
3430
+ } catch (error) {
3431
+ return !0;
3490
3432
  }
3491
3433
  }
3492
- } // Because updates are synchronous, we don't queue them. Instead we force a
3493
- // re-render whenever the subscribed state changes by updating an some
3494
- // arbitrary useState hook. Then, during render, we call getSnapshot to read
3495
- // the current value.
3496
- //
3497
- // Because we don't actually use the state returned by the useState hook, we
3498
- // can save a bit of memory by storing other stuff in that slot.
3499
- //
3500
- // To implement the early bailout, we need to track some things on a mutable
3501
- // object. Usually, we would put that in a useRef hook, but we can stash it in
3502
- // our useState hook instead.
3503
- //
3504
- // To force a re-render, we call forceUpdate({inst}). That works because the
3505
- // new object always fails an equality check.
3506
-
3507
-
3508
- var _useState = useState({
3509
- inst: {
3510
- value: value,
3511
- getSnapshot: getSnapshot
3512
- }
3513
- }),
3514
- inst = _useState[0].inst,
3515
- forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
3516
- // in the layout phase so we can access it during the tearing check that
3517
- // happens on subscribe.
3518
-
3519
-
3520
- useLayoutEffect(function () {
3521
- inst.value = value;
3522
- inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
3523
- // commit phase if there was an interleaved mutation. In concurrent mode
3524
- // this can happen all the time, but even in synchronous mode, an earlier
3525
- // effect may have mutated the store.
3526
-
3527
- if (checkIfSnapshotChanged(inst)) {
3528
- // Force a re-render.
3529
- forceUpdate({
3530
- inst: inst
3531
- });
3532
- }
3533
- }, [subscribe, value, getSnapshot]);
3534
- useEffect(function () {
3535
- // Check for changes right before subscribing. Subsequent changes will be
3536
- // detected in the subscription handler.
3537
- if (checkIfSnapshotChanged(inst)) {
3538
- // Force a re-render.
3539
- forceUpdate({
3540
- inst: inst
3541
- });
3434
+ function useSyncExternalStore$1(subscribe, getSnapshot) {
3435
+ return getSnapshot();
3542
3436
  }
3543
-
3544
- var handleStoreChange = function () {
3545
- // TODO: Because there is no cross-renderer API for batching updates, it's
3546
- // up to the consumer of this library to wrap their subscription event
3547
- // with unstable_batchedUpdates. Should we try to detect when this isn't
3548
- // the case and print a warning in development?
3549
- // The store changed. Check if the snapshot changed since the last time we
3550
- // read from the store.
3551
- if (checkIfSnapshotChanged(inst)) {
3552
- // Force a re-render.
3553
- forceUpdate({
3554
- inst: inst
3555
- });
3556
- }
3557
- }; // Subscribe to the store and return a clean-up function.
3558
-
3559
-
3560
- return subscribe(handleStoreChange);
3561
- }, [subscribe]);
3562
- useDebugValue(value);
3563
- return value;
3564
- }
3565
-
3566
- function checkIfSnapshotChanged(inst) {
3567
- var latestGetSnapshot = inst.getSnapshot;
3568
- var prevValue = inst.value;
3569
-
3570
- try {
3571
- var nextValue = latestGetSnapshot();
3572
- return !objectIs(prevValue, nextValue);
3573
- } catch (error) {
3574
- return true;
3575
- }
3576
- }
3577
-
3578
- function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
3579
- // Note: The shim does not use getServerSnapshot, because pre-18 versions of
3580
- // React do not expose a way to check if we're hydrating. So users of the shim
3581
- // will need to track that themselves and return the correct value
3582
- // from `getSnapshot`.
3583
- return getSnapshot();
3584
- }
3585
-
3586
- var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
3587
-
3588
- var isServerEnvironment = !canUseDOM;
3589
-
3590
- var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
3591
- var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
3592
-
3593
- useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
3594
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
3595
- if (
3596
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
3597
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
3598
- 'function'
3599
- ) {
3600
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
3601
- }
3602
-
3603
- })();
3604
- }
3437
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
3438
+ "function" ===
3439
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
3440
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
3441
+ var React = React__default["default"],
3442
+ objectIs = "function" === typeof Object.is ? Object.is : is,
3443
+ useState = React.useState,
3444
+ useEffect = React.useEffect,
3445
+ useLayoutEffect = React.useLayoutEffect,
3446
+ useDebugValue = React.useDebugValue,
3447
+ didWarnOld18Alpha = !1,
3448
+ didWarnUncachedGetSnapshot = !1,
3449
+ shim =
3450
+ "undefined" === typeof window ||
3451
+ "undefined" === typeof window.document ||
3452
+ "undefined" === typeof window.document.createElement
3453
+ ? useSyncExternalStore$1
3454
+ : useSyncExternalStore$2;
3455
+ useSyncExternalStoreShim_development.useSyncExternalStore =
3456
+ void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
3457
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
3458
+ "function" ===
3459
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
3460
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
3461
+ }))();
3605
3462
  return useSyncExternalStoreShim_development;
3606
3463
  }
3607
3464
 
@@ -4025,6 +3882,22 @@
4025
3882
  return useBaseQuery(options, InfiniteQueryObserver);
4026
3883
  }
4027
3884
 
3885
+ function usePrefetchQuery(options) {
3886
+ const client = useQueryClient();
3887
+
3888
+ if (!client.getQueryState(options.queryKey)) {
3889
+ client.prefetchQuery(options);
3890
+ }
3891
+ }
3892
+
3893
+ function usePrefetchInfiniteQuery(options) {
3894
+ const client = useQueryClient();
3895
+
3896
+ if (!client.getQueryState(options.queryKey)) {
3897
+ client.prefetchInfiniteQuery(options);
3898
+ }
3899
+ }
3900
+
4028
3901
  exports.CancelledError = CancelledError;
4029
3902
  exports.Hydrate = Hydrate;
4030
3903
  exports.InfiniteQueryObserver = InfiniteQueryObserver;
@@ -4064,6 +3937,8 @@
4064
3937
  exports.useIsMutating = useIsMutating;
4065
3938
  exports.useIsRestoring = useIsRestoring;
4066
3939
  exports.useMutation = useMutation;
3940
+ exports.usePrefetchInfiniteQuery = usePrefetchInfiniteQuery;
3941
+ exports.usePrefetchQuery = usePrefetchQuery;
4067
3942
  exports.useQueries = useQueries;
4068
3943
  exports.useQuery = useQuery;
4069
3944
  exports.useQueryClient = useQueryClient;