@tanstack/react-query-devtools 4.0.8 → 4.0.11-beta.4

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 (99) hide show
  1. package/build/{types/react-query-devtools/src → lib}/Explorer.d.ts +0 -0
  2. package/build/{types/react-query-devtools/src → lib}/Logo.d.ts +0 -0
  3. package/build/{types/react-query-devtools/src → lib}/devtools.d.ts +0 -0
  4. package/build/{types/react-query-devtools/src → lib}/index.d.ts +0 -0
  5. package/build/lib/index.js +2286 -0
  6. package/build/lib/index.js.map +1 -0
  7. package/build/{esm/index.js → lib/index.mjs} +282 -3
  8. package/build/lib/index.mjs.map +1 -0
  9. package/build/{types/react-query-devtools/src → lib}/noop.d.ts +0 -0
  10. package/build/{cjs → lib}/noop.js +0 -0
  11. package/build/{cjs → lib}/noop.js.map +0 -0
  12. package/build/{esm/noop.js → lib/noop.mjs} +1 -1
  13. package/build/lib/noop.mjs.map +1 -0
  14. package/build/{types/react-query-devtools/src → lib}/styledComponents.d.ts +0 -0
  15. package/build/{types/react-query-devtools/src → lib}/theme.d.ts +0 -0
  16. package/build/{types/react-query-devtools/src → lib}/useLocalStorage.d.ts +0 -0
  17. package/build/{types/react-query-devtools/src → lib}/useMediaQuery.d.ts +0 -0
  18. package/build/lib/useSyncExternalStore.d.ts +1 -0
  19. package/build/lib/useSyncExternalStore.native.d.ts +1 -0
  20. package/build/{types/react-query-devtools/src → lib}/utils.d.ts +0 -0
  21. package/build/umd/index.development.js +2240 -9
  22. package/build/umd/index.development.js.map +1 -1
  23. package/build/umd/index.production.js +2 -2
  24. package/build/umd/index.production.js.map +1 -1
  25. package/build/umd/noop.development.js +30 -0
  26. package/build/umd/noop.development.js.map +1 -0
  27. package/build/umd/noop.production.js +12 -0
  28. package/build/umd/noop.production.js.map +1 -0
  29. package/cjs.fallback.js +13 -0
  30. package/package.json +36 -19
  31. package/src/devtools.tsx +1 -1
  32. package/src/useSyncExternalStore.native.ts +3 -0
  33. package/src/useSyncExternalStore.ts +2 -0
  34. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -33
  35. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  36. package/build/cjs/node_modules/@tanstack/match-sorter-utils/build/esm/index.js +0 -757
  37. package/build/cjs/node_modules/@tanstack/match-sorter-utils/build/esm/index.js.map +0 -1
  38. package/build/cjs/packages/react-query-devtools/src/Explorer.js +0 -215
  39. package/build/cjs/packages/react-query-devtools/src/Explorer.js.map +0 -1
  40. package/build/cjs/packages/react-query-devtools/src/Logo.js +0 -66
  41. package/build/cjs/packages/react-query-devtools/src/Logo.js.map +0 -1
  42. package/build/cjs/packages/react-query-devtools/src/devtools.js +0 -805
  43. package/build/cjs/packages/react-query-devtools/src/devtools.js.map +0 -1
  44. package/build/cjs/packages/react-query-devtools/src/index.js +0 -26
  45. package/build/cjs/packages/react-query-devtools/src/index.js.map +0 -1
  46. package/build/cjs/packages/react-query-devtools/src/styledComponents.js +0 -113
  47. package/build/cjs/packages/react-query-devtools/src/styledComponents.js.map +0 -1
  48. package/build/cjs/packages/react-query-devtools/src/theme.js +0 -68
  49. package/build/cjs/packages/react-query-devtools/src/theme.js.map +0 -1
  50. package/build/cjs/packages/react-query-devtools/src/useLocalStorage.js +0 -81
  51. package/build/cjs/packages/react-query-devtools/src/useLocalStorage.js.map +0 -1
  52. package/build/cjs/packages/react-query-devtools/src/useMediaQuery.js +0 -66
  53. package/build/cjs/packages/react-query-devtools/src/useMediaQuery.js.map +0 -1
  54. package/build/cjs/packages/react-query-devtools/src/utils.js +0 -113
  55. package/build/cjs/packages/react-query-devtools/src/utils.js.map +0 -1
  56. package/build/esm/index.js.map +0 -1
  57. package/build/esm/noop.js.map +0 -1
  58. package/build/stats-html.html +0 -2689
  59. package/build/stats.json +0 -45
  60. package/build/types/query-core/src/focusManager.d.ts +0 -16
  61. package/build/types/query-core/src/hydration.d.ts +0 -34
  62. package/build/types/query-core/src/index.d.ts +0 -20
  63. package/build/types/query-core/src/infiniteQueryBehavior.d.ts +0 -15
  64. package/build/types/query-core/src/infiniteQueryObserver.d.ts +0 -18
  65. package/build/types/query-core/src/logger.d.ts +0 -8
  66. package/build/types/query-core/src/mutation.d.ts +0 -70
  67. package/build/types/query-core/src/mutationCache.d.ts +0 -52
  68. package/build/types/query-core/src/mutationObserver.d.ts +0 -23
  69. package/build/types/query-core/src/notifyManager.d.ts +0 -18
  70. package/build/types/query-core/src/onlineManager.d.ts +0 -16
  71. package/build/types/query-core/src/queriesObserver.d.ts +0 -23
  72. package/build/types/query-core/src/query.d.ts +0 -119
  73. package/build/types/query-core/src/queryCache.d.ts +0 -59
  74. package/build/types/query-core/src/queryClient.d.ts +0 -65
  75. package/build/types/query-core/src/queryObserver.d.ts +0 -61
  76. package/build/types/query-core/src/removable.d.ts +0 -9
  77. package/build/types/query-core/src/retryer.d.ts +0 -33
  78. package/build/types/query-core/src/subscribable.d.ts +0 -10
  79. package/build/types/query-core/src/types.d.ts +0 -417
  80. package/build/types/query-core/src/utils.d.ts +0 -99
  81. package/build/types/react-query/src/Hydrate.d.ts +0 -10
  82. package/build/types/react-query/src/QueryClientProvider.d.ts +0 -24
  83. package/build/types/react-query/src/QueryErrorResetBoundary.d.ts +0 -12
  84. package/build/types/react-query/src/index.d.ts +0 -17
  85. package/build/types/react-query/src/isRestoring.d.ts +0 -3
  86. package/build/types/react-query/src/reactBatchedUpdates.d.ts +0 -2
  87. package/build/types/react-query/src/setBatchUpdatesFn.d.ts +0 -1
  88. package/build/types/react-query/src/types.d.ts +0 -35
  89. package/build/types/react-query/src/useBaseQuery.d.ts +0 -3
  90. package/build/types/react-query/src/useInfiniteQuery.d.ts +0 -5
  91. package/build/types/react-query/src/useIsFetching.d.ts +0 -7
  92. package/build/types/react-query/src/useIsMutating.d.ts +0 -7
  93. package/build/types/react-query/src/useMutation.d.ts +0 -6
  94. package/build/types/react-query/src/useQueries.d.ts +0 -49
  95. package/build/types/react-query/src/useQuery.d.ts +0 -20
  96. package/build/types/react-query/src/utils.d.ts +0 -1
  97. package/build/types/react-query-devtools/src/__tests__/Explorer.test.d.ts +0 -1
  98. package/build/types/react-query-devtools/src/__tests__/devtools.test.d.ts +0 -6
  99. package/build/types/react-query-devtools/src/__tests__/utils.d.ts +0 -22
@@ -9,7 +9,7 @@
9
9
  * @license MIT
10
10
  */
11
11
  import * as React from 'react';
12
- import { useSyncExternalStore } from 'use-sync-external-store/shim';
12
+ import React__default from 'react';
13
13
  import { useQueryClient, notifyManager, onlineManager } from '@tanstack/react-query';
14
14
 
15
15
  function _extends() {
@@ -29,6 +29,285 @@ 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
+
32
311
  /**
33
312
  * match-sorter-utils
34
313
  *
@@ -1454,7 +1733,7 @@ function ReactQueryDevtools$1({
1454
1733
  }
1455
1734
 
1456
1735
  const useSubscribeToQueryCache = (queryCache, getSnapshot) => {
1457
- return useSyncExternalStore(React.useCallback(onStoreChange => queryCache.subscribe(notifyManager.batchCalls(onStoreChange)), [queryCache]), getSnapshot, getSnapshot);
1736
+ return shim.exports.useSyncExternalStore(React.useCallback(onStoreChange => queryCache.subscribe(notifyManager.batchCalls(onStoreChange)), [queryCache]), getSnapshot, getSnapshot);
1458
1737
  };
1459
1738
 
1460
1739
  const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
@@ -1977,4 +2256,4 @@ const ReactQueryDevtoolsPanel = process.env.NODE_ENV !== 'development' ? functio
1977
2256
  } : ReactQueryDevtoolsPanel$1;
1978
2257
 
1979
2258
  export { ReactQueryDevtools, ReactQueryDevtoolsPanel };
1980
- //# sourceMappingURL=index.js.map
2259
+ //# sourceMappingURL=index.mjs.map