@tanstack/react-query-devtools 4.0.11-beta.0 → 4.2.1
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/cjs/_virtual/_rollupPluginBabelHelpers.js +33 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/build/cjs/node_modules/@tanstack/match-sorter-utils/build/esm/index.js +757 -0
- package/build/cjs/node_modules/@tanstack/match-sorter-utils/build/esm/index.js.map +1 -0
- package/build/{lib → cjs}/noop.js +0 -0
- package/build/{lib → cjs}/noop.js.map +0 -0
- package/build/cjs/packages/react-query-devtools/src/Explorer.js +215 -0
- package/build/cjs/packages/react-query-devtools/src/Explorer.js.map +1 -0
- package/build/cjs/packages/react-query-devtools/src/Logo.js +66 -0
- package/build/cjs/packages/react-query-devtools/src/Logo.js.map +1 -0
- package/build/cjs/packages/react-query-devtools/src/devtools.js +805 -0
- package/build/cjs/packages/react-query-devtools/src/devtools.js.map +1 -0
- package/build/cjs/packages/react-query-devtools/src/index.js +26 -0
- package/build/cjs/packages/react-query-devtools/src/index.js.map +1 -0
- package/build/cjs/packages/react-query-devtools/src/styledComponents.js +113 -0
- package/build/cjs/packages/react-query-devtools/src/styledComponents.js.map +1 -0
- package/build/cjs/packages/react-query-devtools/src/theme.js +68 -0
- package/build/cjs/packages/react-query-devtools/src/theme.js.map +1 -0
- package/build/cjs/packages/react-query-devtools/src/useLocalStorage.js +81 -0
- package/build/cjs/packages/react-query-devtools/src/useLocalStorage.js.map +1 -0
- package/build/cjs/packages/react-query-devtools/src/useMediaQuery.js +66 -0
- package/build/cjs/packages/react-query-devtools/src/useMediaQuery.js.map +1 -0
- package/build/cjs/packages/react-query-devtools/src/utils.js +113 -0
- package/build/cjs/packages/react-query-devtools/src/utils.js.map +1 -0
- package/build/{lib/index.mjs → esm/index.js} +3 -282
- package/build/esm/index.js.map +1 -0
- package/build/{lib/noop.mjs → esm/noop.js} +1 -1
- package/build/esm/noop.js.map +1 -0
- package/build/stats-html.html +2689 -0
- package/build/stats.json +45 -0
- package/build/types/query-core/src/focusManager.d.ts +16 -0
- package/build/types/query-core/src/hydration.d.ts +34 -0
- package/build/types/query-core/src/index.d.ts +20 -0
- package/build/types/query-core/src/infiniteQueryBehavior.d.ts +15 -0
- package/build/types/query-core/src/infiniteQueryObserver.d.ts +18 -0
- package/build/types/query-core/src/logger.d.ts +8 -0
- package/build/types/query-core/src/mutation.d.ts +70 -0
- package/build/types/query-core/src/mutationCache.d.ts +57 -0
- package/build/types/query-core/src/mutationObserver.d.ts +23 -0
- package/build/types/query-core/src/notifyManager.d.ts +18 -0
- package/build/types/query-core/src/onlineManager.d.ts +16 -0
- package/build/types/query-core/src/queriesObserver.d.ts +23 -0
- package/build/types/query-core/src/query.d.ts +119 -0
- package/build/types/query-core/src/queryCache.d.ts +64 -0
- package/build/types/query-core/src/queryClient.d.ts +65 -0
- package/build/types/query-core/src/queryObserver.d.ts +61 -0
- package/build/types/query-core/src/removable.d.ts +9 -0
- package/build/types/query-core/src/retryer.d.ts +33 -0
- package/build/types/query-core/src/subscribable.d.ts +10 -0
- package/build/types/query-core/src/types.d.ts +419 -0
- package/build/types/query-core/src/utils.d.ts +99 -0
- package/build/types/react-query/src/Hydrate.d.ts +10 -0
- package/build/types/react-query/src/QueryClientProvider.d.ts +24 -0
- package/build/types/react-query/src/QueryErrorResetBoundary.d.ts +12 -0
- package/build/types/react-query/src/index.d.ts +17 -0
- package/build/types/react-query/src/isRestoring.d.ts +3 -0
- package/build/types/react-query/src/reactBatchedUpdates.d.ts +2 -0
- package/build/types/react-query/src/setBatchUpdatesFn.d.ts +1 -0
- package/build/types/react-query/src/types.d.ts +34 -0
- package/build/types/react-query/src/useBaseQuery.d.ts +3 -0
- package/build/types/react-query/src/useInfiniteQuery.d.ts +5 -0
- package/build/types/react-query/src/useIsFetching.d.ts +7 -0
- package/build/types/react-query/src/useIsMutating.d.ts +7 -0
- package/build/types/react-query/src/useMutation.d.ts +6 -0
- package/build/types/react-query/src/useQueries.d.ts +49 -0
- package/build/types/react-query/src/useQuery.d.ts +23 -0
- package/build/types/react-query/src/utils.d.ts +1 -0
- package/build/{lib → types/react-query-devtools/src}/Explorer.d.ts +0 -0
- package/build/{lib → types/react-query-devtools/src}/Logo.d.ts +0 -0
- package/build/types/react-query-devtools/src/__tests__/Explorer.test.d.ts +1 -0
- package/build/types/react-query-devtools/src/__tests__/devtools.test.d.ts +6 -0
- package/build/types/react-query-devtools/src/__tests__/utils.d.ts +22 -0
- package/build/{lib → types/react-query-devtools/src}/devtools.d.ts +0 -0
- package/build/{lib → types/react-query-devtools/src}/index.d.ts +0 -0
- package/build/{lib → types/react-query-devtools/src}/noop.d.ts +0 -0
- package/build/{lib → types/react-query-devtools/src}/styledComponents.d.ts +0 -0
- package/build/{lib → types/react-query-devtools/src}/theme.d.ts +0 -0
- package/build/{lib → types/react-query-devtools/src}/useLocalStorage.d.ts +0 -0
- package/build/{lib → types/react-query-devtools/src}/useMediaQuery.d.ts +0 -0
- package/build/{lib → types/react-query-devtools/src}/utils.d.ts +0 -0
- package/build/umd/index.development.js +9 -2240
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +21 -28
- package/src/devtools.tsx +1 -1
- package/build/lib/index.js +0 -2286
- package/build/lib/index.js.map +0 -1
- package/build/lib/index.mjs.map +0 -1
- package/build/lib/noop.mjs.map +0 -1
- package/build/lib/useSyncExternalStore.d.ts +0 -1
- package/build/lib/useSyncExternalStore.native.d.ts +0 -1
- package/build/umd/noop.development.js +0 -30
- package/build/umd/noop.development.js.map +0 -1
- package/build/umd/noop.production.js +0 -12
- package/build/umd/noop.production.js.map +0 -1
- package/src/useSyncExternalStore.native.ts +0 -3
- package/src/useSyncExternalStore.ts +0 -2
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-query-devtools
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
+
|
|
15
|
+
var React = require('react');
|
|
16
|
+
var theme = require('./theme.js');
|
|
17
|
+
var useMediaQuery = require('./useMediaQuery.js');
|
|
18
|
+
|
|
19
|
+
function _interopNamespace(e) {
|
|
20
|
+
if (e && e.__esModule) return e;
|
|
21
|
+
var n = Object.create(null);
|
|
22
|
+
if (e) {
|
|
23
|
+
Object.keys(e).forEach(function (k) {
|
|
24
|
+
if (k !== 'default') {
|
|
25
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
26
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return e[k]; }
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
n["default"] = e;
|
|
34
|
+
return Object.freeze(n);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
38
|
+
|
|
39
|
+
const isServer = typeof window === 'undefined';
|
|
40
|
+
function getQueryStatusColor({
|
|
41
|
+
queryState,
|
|
42
|
+
observerCount,
|
|
43
|
+
isStale,
|
|
44
|
+
theme
|
|
45
|
+
}) {
|
|
46
|
+
return queryState.fetchStatus === 'fetching' ? theme.active : !observerCount ? theme.gray : queryState.fetchStatus === 'paused' ? theme.paused : isStale ? theme.warning : theme.success;
|
|
47
|
+
}
|
|
48
|
+
function getQueryStatusLabel(query) {
|
|
49
|
+
return query.state.fetchStatus === 'fetching' ? 'fetching' : !query.getObserversCount() ? 'inactive' : query.state.fetchStatus === 'paused' ? 'paused' : query.isStale() ? 'stale' : 'fresh';
|
|
50
|
+
}
|
|
51
|
+
function styled(type, newStyles, queries = {}) {
|
|
52
|
+
return /*#__PURE__*/React__namespace.forwardRef(({
|
|
53
|
+
style,
|
|
54
|
+
...rest
|
|
55
|
+
}, ref) => {
|
|
56
|
+
const theme$1 = theme.useTheme();
|
|
57
|
+
const mediaStyles = Object.entries(queries).reduce((current, [key, value]) => {
|
|
58
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
59
|
+
return useMediaQuery["default"](key) ? { ...current,
|
|
60
|
+
...(typeof value === 'function' ? value(rest, theme$1) : value)
|
|
61
|
+
} : current;
|
|
62
|
+
}, {});
|
|
63
|
+
return /*#__PURE__*/React__namespace.createElement(type, { ...rest,
|
|
64
|
+
style: { ...(typeof newStyles === 'function' ? newStyles(rest, theme$1) : newStyles),
|
|
65
|
+
...style,
|
|
66
|
+
...mediaStyles
|
|
67
|
+
},
|
|
68
|
+
ref
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function useIsMounted() {
|
|
73
|
+
const mountedRef = React__namespace.useRef(false);
|
|
74
|
+
const isMounted = React__namespace.useCallback(() => mountedRef.current, []);
|
|
75
|
+
React__namespace[isServer ? 'useEffect' : 'useLayoutEffect'](() => {
|
|
76
|
+
mountedRef.current = true;
|
|
77
|
+
return () => {
|
|
78
|
+
mountedRef.current = false;
|
|
79
|
+
};
|
|
80
|
+
}, []);
|
|
81
|
+
return isMounted;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Displays a string regardless the type of the data
|
|
85
|
+
* @param {unknown} value Value to be stringified
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
const displayValue = value => {
|
|
89
|
+
const name = Object.getOwnPropertyNames(Object(value));
|
|
90
|
+
const newValue = typeof value === 'bigint' ? value.toString() + "n" : value;
|
|
91
|
+
return JSON.stringify(newValue, name);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const getStatusRank = q => q.state.fetchStatus !== 'idle' ? 0 : !q.getObserversCount() ? 3 : q.isStale() ? 2 : 1;
|
|
95
|
+
|
|
96
|
+
const sortFns = {
|
|
97
|
+
'Status > Last Updated': (a, b) => {
|
|
98
|
+
var _sortFns$LastUpdated;
|
|
99
|
+
|
|
100
|
+
return getStatusRank(a) === getStatusRank(b) ? (_sortFns$LastUpdated = sortFns['Last Updated']) == null ? void 0 : _sortFns$LastUpdated.call(sortFns, a, b) : getStatusRank(a) > getStatusRank(b) ? 1 : -1;
|
|
101
|
+
},
|
|
102
|
+
'Query Hash': (a, b) => a.queryHash > b.queryHash ? 1 : -1,
|
|
103
|
+
'Last Updated': (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
exports.displayValue = displayValue;
|
|
107
|
+
exports.getQueryStatusColor = getQueryStatusColor;
|
|
108
|
+
exports.getQueryStatusLabel = getQueryStatusLabel;
|
|
109
|
+
exports.isServer = isServer;
|
|
110
|
+
exports.sortFns = sortFns;
|
|
111
|
+
exports.styled = styled;
|
|
112
|
+
exports.useIsMounted = useIsMounted;
|
|
113
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../src/utils.ts"],"sourcesContent":["import * as React from 'react'\nimport type { Query } from '@tanstack/react-query'\n\nimport { Theme, useTheme } from './theme'\nimport useMediaQuery from './useMediaQuery'\n\nexport const isServer = typeof window === 'undefined'\n\ntype StyledComponent<T> = T extends 'button'\n ? React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >\n : T extends 'input'\n ? React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >\n : T extends 'select'\n ? React.DetailedHTMLProps<\n React.SelectHTMLAttributes<HTMLSelectElement>,\n HTMLSelectElement\n >\n : T extends keyof HTMLElementTagNameMap\n ? React.HTMLAttributes<HTMLElementTagNameMap[T]>\n : never\n\nexport function getQueryStatusColor({\n queryState,\n observerCount,\n isStale,\n theme,\n}: {\n queryState: Query['state']\n observerCount: number\n isStale: boolean\n theme: Theme\n}) {\n return queryState.fetchStatus === 'fetching'\n ? theme.active\n : !observerCount\n ? theme.gray\n : queryState.fetchStatus === 'paused'\n ? theme.paused\n : isStale\n ? theme.warning\n : theme.success\n}\n\nexport function getQueryStatusLabel(query: Query) {\n return query.state.fetchStatus === 'fetching'\n ? 'fetching'\n : !query.getObserversCount()\n ? 'inactive'\n : query.state.fetchStatus === 'paused'\n ? 'paused'\n : query.isStale()\n ? 'stale'\n : 'fresh'\n}\n\ntype Styles =\n | React.CSSProperties\n | ((props: Record<string, any>, theme: Theme) => React.CSSProperties)\n\nexport function styled<T extends keyof HTMLElementTagNameMap>(\n type: T,\n newStyles: Styles,\n queries: Record<string, Styles> = {},\n) {\n return React.forwardRef<HTMLElementTagNameMap[T], StyledComponent<T>>(\n ({ style, ...rest }, ref) => {\n const theme = useTheme()\n\n const mediaStyles = Object.entries(queries).reduce(\n (current, [key, value]) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useMediaQuery(key)\n ? {\n ...current,\n ...(typeof value === 'function' ? value(rest, theme) : value),\n }\n : current\n },\n {},\n )\n\n return React.createElement(type, {\n ...rest,\n style: {\n ...(typeof newStyles === 'function'\n ? newStyles(rest, theme)\n : newStyles),\n ...style,\n ...mediaStyles,\n },\n ref,\n })\n },\n )\n}\n\nexport function useIsMounted() {\n const mountedRef = React.useRef(false)\n const isMounted = React.useCallback(() => mountedRef.current, [])\n\n React[isServer ? 'useEffect' : 'useLayoutEffect'](() => {\n mountedRef.current = true\n return () => {\n mountedRef.current = false\n }\n }, [])\n\n return isMounted\n}\n\n/**\n * Displays a string regardless the type of the data\n * @param {unknown} value Value to be stringified\n */\nexport const displayValue = (value: unknown) => {\n const name = Object.getOwnPropertyNames(Object(value))\n const newValue = typeof value === 'bigint' ? `${value.toString()}n` : value\n\n return JSON.stringify(newValue, name)\n}\n\nconst getStatusRank = (q: Query) =>\n q.state.fetchStatus !== 'idle'\n ? 0\n : !q.getObserversCount()\n ? 3\n : q.isStale()\n ? 2\n : 1\n\nexport const sortFns: Record<string, (a: Query, b: Query) => number> = {\n 'Status > Last Updated': (a, b) =>\n getStatusRank(a) === getStatusRank(b)\n ? (sortFns['Last Updated']?.(a, b) as number)\n : getStatusRank(a) > getStatusRank(b)\n ? 1\n : -1,\n 'Query Hash': (a, b) => (a.queryHash > b.queryHash ? 1 : -1),\n 'Last Updated': (a, b) =>\n a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1,\n}\n"],"names":["isServer","window","getQueryStatusColor","queryState","observerCount","isStale","theme","fetchStatus","active","gray","paused","warning","success","getQueryStatusLabel","query","state","getObserversCount","styled","type","newStyles","queries","React","forwardRef","style","rest","ref","useTheme","mediaStyles","Object","entries","reduce","current","key","value","useMediaQuery","createElement","useIsMounted","mountedRef","useRef","isMounted","useCallback","displayValue","name","getOwnPropertyNames","newValue","toString","JSON","stringify","getStatusRank","q","sortFns","a","b","queryHash","dataUpdatedAt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMaA,QAAQ,GAAG,OAAOC,MAAP,KAAkB,YAAnC;AAqBA,SAASC,mBAAT,CAA6B;EAClCC,UADkC;EAElCC,aAFkC;EAGlCC,OAHkC;AAIlCC,EAAAA,KAAAA;AAJkC,CAA7B,EAUJ;AACD,EAAA,OAAOH,UAAU,CAACI,WAAX,KAA2B,UAA3B,GACHD,KAAK,CAACE,MADH,GAEH,CAACJ,aAAD,GACAE,KAAK,CAACG,IADN,GAEAN,UAAU,CAACI,WAAX,KAA2B,QAA3B,GACAD,KAAK,CAACI,MADN,GAEAL,OAAO,GACPC,KAAK,CAACK,OADC,GAEPL,KAAK,CAACM,OARV,CAAA;AASD,CAAA;AAEM,SAASC,mBAAT,CAA6BC,KAA7B,EAA2C;AAChD,EAAA,OAA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BH,aAAa,CAACI,CAAD,CAAlC,GAAA,CAAA,oBAAA,GACKF,OAAO,CAAC,cAAD,CADZ,KAAA,IAAA,GAAA,KAAA,CAAA,GACK,0BAAAA,OAAO,EAAmBC,CAAnB,EAAsBC,CAAtB,CADZ,GAEIJ,aAAa,CAACG,CAAD,CAAb,GAAmBH,aAAa,CAACI,CAAD,CAAhC,GACA,CADA,GAEA,CAAC,CALkB,CAAA;GAD4C;AAOrE,EAAA,YAAA,EAAc,CAACD,CAAD,EAAIC,CAAJ,KAAWD,CAAC,CAACE,SAAF,GAAcD,CAAC,CAACC,SAAhB,GAA4B,CAA5B,GAAgC,CAAC,CAPW;AAQrE,EAAA,cAAA,EAAgB,CAACF,CAAD,EAAIC,CAAJ,KACdD,CAAC,CAACpC,KAAF,CAAQuC,aAAR,GAAwBF,CAAC,CAACrC,KAAF,CAAQuC,aAAhC,GAAgD,CAAhD,GAAoD,CAAC,CAAA;AATc;;;;;;;;;;"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
|
-
import
|
|
12
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
13
13
|
import { useQueryClient, notifyManager, onlineManager } from '@tanstack/react-query';
|
|
14
14
|
|
|
15
15
|
function _extends() {
|
|
@@ -29,285 +29,6 @@ function _extends() {
|
|
|
29
29
|
return _extends.apply(this, arguments);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
var shim = {exports: {}};
|
|
33
|
-
|
|
34
|
-
var useSyncExternalStoreShim_production_min = {};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @license React
|
|
38
|
-
* use-sync-external-store-shim.production.min.js
|
|
39
|
-
*
|
|
40
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
41
|
-
*
|
|
42
|
-
* This source code is licensed under the MIT license found in the
|
|
43
|
-
* LICENSE file in the root directory of this source tree.
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
var hasRequiredUseSyncExternalStoreShim_production_min;
|
|
47
|
-
|
|
48
|
-
function requireUseSyncExternalStoreShim_production_min () {
|
|
49
|
-
if (hasRequiredUseSyncExternalStoreShim_production_min) return useSyncExternalStoreShim_production_min;
|
|
50
|
-
hasRequiredUseSyncExternalStoreShim_production_min = 1;
|
|
51
|
-
var e=React__default;function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c});},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c});})},[a]);p(d);return d}
|
|
52
|
-
function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return !k(a,d)}catch(f){return !0}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;useSyncExternalStoreShim_production_min.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;
|
|
53
|
-
return useSyncExternalStoreShim_production_min;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
var useSyncExternalStoreShim_development = {};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @license React
|
|
60
|
-
* use-sync-external-store-shim.development.js
|
|
61
|
-
*
|
|
62
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
63
|
-
*
|
|
64
|
-
* This source code is licensed under the MIT license found in the
|
|
65
|
-
* LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
var hasRequiredUseSyncExternalStoreShim_development;
|
|
69
|
-
|
|
70
|
-
function requireUseSyncExternalStoreShim_development () {
|
|
71
|
-
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
72
|
-
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
73
|
-
|
|
74
|
-
if (process.env.NODE_ENV !== "production") {
|
|
75
|
-
(function() {
|
|
76
|
-
|
|
77
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
78
|
-
if (
|
|
79
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
80
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
81
|
-
'function'
|
|
82
|
-
) {
|
|
83
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
84
|
-
}
|
|
85
|
-
var React = React__default;
|
|
86
|
-
|
|
87
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
88
|
-
|
|
89
|
-
function error(format) {
|
|
90
|
-
{
|
|
91
|
-
{
|
|
92
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
93
|
-
args[_key2 - 1] = arguments[_key2];
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
printWarning('error', format, args);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function printWarning(level, format, args) {
|
|
102
|
-
// When changing this logic, you might want to also
|
|
103
|
-
// update consoleWithStackDev.www.js as well.
|
|
104
|
-
{
|
|
105
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
106
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
107
|
-
|
|
108
|
-
if (stack !== '') {
|
|
109
|
-
format += '%s';
|
|
110
|
-
args = args.concat([stack]);
|
|
111
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
var argsWithFormat = args.map(function (item) {
|
|
115
|
-
return String(item);
|
|
116
|
-
}); // Careful: RN currently depends on this prefix
|
|
117
|
-
|
|
118
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
119
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
120
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
121
|
-
|
|
122
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
128
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
129
|
-
*/
|
|
130
|
-
function is(x, y) {
|
|
131
|
-
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
|
132
|
-
;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
|
136
|
-
|
|
137
|
-
// dispatch for CommonJS interop named imports.
|
|
138
|
-
|
|
139
|
-
var useState = React.useState,
|
|
140
|
-
useEffect = React.useEffect,
|
|
141
|
-
useLayoutEffect = React.useLayoutEffect,
|
|
142
|
-
useDebugValue = React.useDebugValue;
|
|
143
|
-
var didWarnOld18Alpha = false;
|
|
144
|
-
var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
|
|
145
|
-
// because of a very particular set of implementation details and assumptions
|
|
146
|
-
// -- change any one of them and it will break. The most important assumption
|
|
147
|
-
// is that updates are always synchronous, because concurrent rendering is
|
|
148
|
-
// only available in versions of React that also have a built-in
|
|
149
|
-
// useSyncExternalStore API. And we only use this shim when the built-in API
|
|
150
|
-
// does not exist.
|
|
151
|
-
//
|
|
152
|
-
// Do not assume that the clever hacks used by this hook also work in general.
|
|
153
|
-
// The point of this shim is to replace the need for hacks by other libraries.
|
|
154
|
-
|
|
155
|
-
function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
156
|
-
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
157
|
-
// will need to track that themselves and return the correct value
|
|
158
|
-
// from `getSnapshot`.
|
|
159
|
-
getServerSnapshot) {
|
|
160
|
-
{
|
|
161
|
-
if (!didWarnOld18Alpha) {
|
|
162
|
-
if (React.startTransition !== undefined) {
|
|
163
|
-
didWarnOld18Alpha = true;
|
|
164
|
-
|
|
165
|
-
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.');
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
} // Read the current snapshot from the store on every render. Again, this
|
|
169
|
-
// breaks the rules of React, and only works here because of specific
|
|
170
|
-
// implementation details, most importantly that updates are
|
|
171
|
-
// always synchronous.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
var value = getSnapshot();
|
|
175
|
-
|
|
176
|
-
{
|
|
177
|
-
if (!didWarnUncachedGetSnapshot) {
|
|
178
|
-
var cachedValue = getSnapshot();
|
|
179
|
-
|
|
180
|
-
if (!objectIs(value, cachedValue)) {
|
|
181
|
-
error('The result of getSnapshot should be cached to avoid an infinite loop');
|
|
182
|
-
|
|
183
|
-
didWarnUncachedGetSnapshot = true;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
} // Because updates are synchronous, we don't queue them. Instead we force a
|
|
187
|
-
// re-render whenever the subscribed state changes by updating an some
|
|
188
|
-
// arbitrary useState hook. Then, during render, we call getSnapshot to read
|
|
189
|
-
// the current value.
|
|
190
|
-
//
|
|
191
|
-
// Because we don't actually use the state returned by the useState hook, we
|
|
192
|
-
// can save a bit of memory by storing other stuff in that slot.
|
|
193
|
-
//
|
|
194
|
-
// To implement the early bailout, we need to track some things on a mutable
|
|
195
|
-
// object. Usually, we would put that in a useRef hook, but we can stash it in
|
|
196
|
-
// our useState hook instead.
|
|
197
|
-
//
|
|
198
|
-
// To force a re-render, we call forceUpdate({inst}). That works because the
|
|
199
|
-
// new object always fails an equality check.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
var _useState = useState({
|
|
203
|
-
inst: {
|
|
204
|
-
value: value,
|
|
205
|
-
getSnapshot: getSnapshot
|
|
206
|
-
}
|
|
207
|
-
}),
|
|
208
|
-
inst = _useState[0].inst,
|
|
209
|
-
forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
|
|
210
|
-
// in the layout phase so we can access it during the tearing check that
|
|
211
|
-
// happens on subscribe.
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
useLayoutEffect(function () {
|
|
215
|
-
inst.value = value;
|
|
216
|
-
inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
|
|
217
|
-
// commit phase if there was an interleaved mutation. In concurrent mode
|
|
218
|
-
// this can happen all the time, but even in synchronous mode, an earlier
|
|
219
|
-
// effect may have mutated the store.
|
|
220
|
-
|
|
221
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
222
|
-
// Force a re-render.
|
|
223
|
-
forceUpdate({
|
|
224
|
-
inst: inst
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}, [subscribe, value, getSnapshot]);
|
|
228
|
-
useEffect(function () {
|
|
229
|
-
// Check for changes right before subscribing. Subsequent changes will be
|
|
230
|
-
// detected in the subscription handler.
|
|
231
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
232
|
-
// Force a re-render.
|
|
233
|
-
forceUpdate({
|
|
234
|
-
inst: inst
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
var handleStoreChange = function () {
|
|
239
|
-
// TODO: Because there is no cross-renderer API for batching updates, it's
|
|
240
|
-
// up to the consumer of this library to wrap their subscription event
|
|
241
|
-
// with unstable_batchedUpdates. Should we try to detect when this isn't
|
|
242
|
-
// the case and print a warning in development?
|
|
243
|
-
// The store changed. Check if the snapshot changed since the last time we
|
|
244
|
-
// read from the store.
|
|
245
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
246
|
-
// Force a re-render.
|
|
247
|
-
forceUpdate({
|
|
248
|
-
inst: inst
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
}; // Subscribe to the store and return a clean-up function.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
return subscribe(handleStoreChange);
|
|
255
|
-
}, [subscribe]);
|
|
256
|
-
useDebugValue(value);
|
|
257
|
-
return value;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
function checkIfSnapshotChanged(inst) {
|
|
261
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
262
|
-
var prevValue = inst.value;
|
|
263
|
-
|
|
264
|
-
try {
|
|
265
|
-
var nextValue = latestGetSnapshot();
|
|
266
|
-
return !objectIs(prevValue, nextValue);
|
|
267
|
-
} catch (error) {
|
|
268
|
-
return true;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
|
|
273
|
-
// Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
274
|
-
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
275
|
-
// will need to track that themselves and return the correct value
|
|
276
|
-
// from `getSnapshot`.
|
|
277
|
-
return getSnapshot();
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
|
|
281
|
-
|
|
282
|
-
var isServerEnvironment = !canUseDOM;
|
|
283
|
-
|
|
284
|
-
var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
|
|
285
|
-
var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
|
|
286
|
-
|
|
287
|
-
useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
|
|
288
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
289
|
-
if (
|
|
290
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
291
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
292
|
-
'function'
|
|
293
|
-
) {
|
|
294
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
})();
|
|
298
|
-
}
|
|
299
|
-
return useSyncExternalStoreShim_development;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
(function (module) {
|
|
303
|
-
|
|
304
|
-
if (process.env.NODE_ENV === 'production') {
|
|
305
|
-
module.exports = requireUseSyncExternalStoreShim_production_min();
|
|
306
|
-
} else {
|
|
307
|
-
module.exports = requireUseSyncExternalStoreShim_development();
|
|
308
|
-
}
|
|
309
|
-
} (shim));
|
|
310
|
-
|
|
311
32
|
/**
|
|
312
33
|
* match-sorter-utils
|
|
313
34
|
*
|
|
@@ -1733,7 +1454,7 @@ function ReactQueryDevtools$1({
|
|
|
1733
1454
|
}
|
|
1734
1455
|
|
|
1735
1456
|
const useSubscribeToQueryCache = (queryCache, getSnapshot) => {
|
|
1736
|
-
return
|
|
1457
|
+
return useSyncExternalStore(React.useCallback(onStoreChange => queryCache.subscribe(notifyManager.batchCalls(onStoreChange)), [queryCache]), getSnapshot, getSnapshot);
|
|
1737
1458
|
};
|
|
1738
1459
|
|
|
1739
1460
|
const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
|
|
@@ -2256,4 +1977,4 @@ const ReactQueryDevtoolsPanel = process.env.NODE_ENV !== 'development' ? functio
|
|
|
2256
1977
|
} : ReactQueryDevtoolsPanel$1;
|
|
2257
1978
|
|
|
2258
1979
|
export { ReactQueryDevtools, ReactQueryDevtoolsPanel };
|
|
2259
|
-
//# sourceMappingURL=index.
|
|
1980
|
+
//# sourceMappingURL=index.js.map
|