@tanstack/react-query-devtools 4.24.9 → 5.0.0-alpha.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/lib/Explorer.d.ts +4 -4
- package/build/lib/Explorer.esm.js +5 -15
- package/build/lib/Explorer.esm.js.map +1 -1
- package/build/lib/Explorer.js +11 -25
- package/build/lib/Explorer.js.map +1 -1
- package/build/lib/Explorer.mjs +5 -15
- package/build/lib/Explorer.mjs.map +1 -1
- package/build/lib/Logo.d.ts +0 -1
- package/build/lib/Logo.esm.js.map +1 -1
- package/build/lib/Logo.js +5 -6
- package/build/lib/Logo.js.map +1 -1
- package/build/lib/Logo.mjs.map +1 -1
- package/build/lib/__tests__/devtools.test.d.ts +0 -5
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js +0 -2
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js.map +1 -1
- package/build/lib/_virtual/_rollupPluginBabelHelpers.js +1 -5
- package/build/lib/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs +0 -2
- package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs.map +1 -1
- package/build/lib/devtools.d.ts +12 -4
- package/build/lib/devtools.esm.js +73 -108
- package/build/lib/devtools.esm.js.map +1 -1
- package/build/lib/devtools.js +95 -133
- package/build/lib/devtools.js.map +1 -1
- package/build/lib/devtools.mjs +73 -108
- package/build/lib/devtools.mjs.map +1 -1
- package/build/lib/index.d.ts +2 -2
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +0 -2
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/index.prod.d.ts +2 -2
- package/build/lib/index.prod.esm.js +121 -176
- package/build/lib/index.prod.esm.js.map +1 -1
- package/build/lib/index.prod.js +126 -187
- package/build/lib/index.prod.js.map +1 -1
- package/build/lib/index.prod.mjs +121 -176
- package/build/lib/index.prod.mjs.map +1 -1
- package/build/lib/screenreader.d.ts +0 -1
- package/build/lib/screenreader.esm.js.map +1 -1
- package/build/lib/screenreader.js +4 -5
- package/build/lib/screenreader.js.map +1 -1
- package/build/lib/screenreader.mjs.map +1 -1
- package/build/lib/styledComponents.esm.js +17 -16
- package/build/lib/styledComponents.esm.js.map +1 -1
- package/build/lib/styledComponents.js +17 -18
- package/build/lib/styledComponents.js.map +1 -1
- package/build/lib/styledComponents.mjs +17 -16
- package/build/lib/styledComponents.mjs.map +1 -1
- package/build/lib/theme.esm.js.map +1 -1
- package/build/lib/theme.js +4 -7
- package/build/lib/theme.js.map +1 -1
- package/build/lib/theme.mjs.map +1 -1
- package/build/lib/useLocalStorage.esm.js +0 -7
- package/build/lib/useLocalStorage.esm.js.map +1 -1
- package/build/lib/useLocalStorage.js +4 -12
- package/build/lib/useLocalStorage.js.map +1 -1
- package/build/lib/useLocalStorage.mjs +0 -7
- package/build/lib/useLocalStorage.mjs.map +1 -1
- package/build/lib/useMediaQuery.esm.js +6 -6
- package/build/lib/useMediaQuery.esm.js.map +1 -1
- package/build/lib/useMediaQuery.js +10 -11
- package/build/lib/useMediaQuery.js.map +1 -1
- package/build/lib/useMediaQuery.mjs +6 -6
- package/build/lib/useMediaQuery.mjs.map +1 -1
- package/build/lib/utils.esm.js +20 -22
- package/build/lib/utils.esm.js.map +1 -1
- package/build/lib/utils.js +24 -32
- package/build/lib/utils.js.map +1 -1
- package/build/lib/utils.mjs +20 -22
- package/build/lib/utils.mjs.map +1 -1
- package/build/umd/index.development.js +124 -439
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +6 -10
- package/src/Explorer.tsx +4 -4
- package/src/__tests__/Explorer.test.tsx +5 -0
- package/src/__tests__/devtools.test.tsx +121 -175
- package/src/__tests__/utils.tsx +2 -2
- package/src/devtools.tsx +110 -116
- package/src/index.ts +2 -2
- package/build/lib/useSyncExternalStore.d.ts +0 -1
- package/build/lib/useSyncExternalStore.native.d.ts +0 -1
- package/src/useSyncExternalStore.native.ts +0 -3
- package/src/useSyncExternalStore.ts +0 -2
package/build/lib/index.prod.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var React = require('react');
|
|
6
4
|
var reactQuery = require('@tanstack/react-query');
|
|
7
5
|
var matchSorterUtils = require('@tanstack/match-sorter-utils');
|
|
8
6
|
var SuperJSON = require('superjson');
|
|
9
|
-
var index_js = require('use-sync-external-store/shim/index.js');
|
|
10
|
-
|
|
11
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
7
|
|
|
13
|
-
function
|
|
14
|
-
if (e && e.__esModule) return e;
|
|
8
|
+
function _interopNamespaceDefault(e) {
|
|
15
9
|
var n = Object.create(null);
|
|
16
10
|
if (e) {
|
|
17
11
|
Object.keys(e).forEach(function (k) {
|
|
@@ -24,25 +18,22 @@ function _interopNamespace(e) {
|
|
|
24
18
|
}
|
|
25
19
|
});
|
|
26
20
|
}
|
|
27
|
-
n
|
|
21
|
+
n.default = e;
|
|
28
22
|
return Object.freeze(n);
|
|
29
23
|
}
|
|
30
24
|
|
|
31
|
-
var React__namespace = /*#__PURE__*/
|
|
32
|
-
var SuperJSON__default = /*#__PURE__*/_interopDefaultLegacy(SuperJSON);
|
|
25
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
33
26
|
|
|
34
27
|
function _extends() {
|
|
35
28
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
36
29
|
for (var i = 1; i < arguments.length; i++) {
|
|
37
30
|
var source = arguments[i];
|
|
38
|
-
|
|
39
31
|
for (var key in source) {
|
|
40
32
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
41
33
|
target[key] = source[key];
|
|
42
34
|
}
|
|
43
35
|
}
|
|
44
36
|
}
|
|
45
|
-
|
|
46
37
|
return target;
|
|
47
38
|
};
|
|
48
39
|
return _extends.apply(this, arguments);
|
|
@@ -51,22 +42,18 @@ function _extends() {
|
|
|
51
42
|
const getItem = key => {
|
|
52
43
|
try {
|
|
53
44
|
const itemValue = localStorage.getItem(key);
|
|
54
|
-
|
|
55
45
|
if (typeof itemValue === 'string') {
|
|
56
46
|
return JSON.parse(itemValue);
|
|
57
47
|
}
|
|
58
|
-
|
|
59
48
|
return undefined;
|
|
60
49
|
} catch {
|
|
61
50
|
return undefined;
|
|
62
51
|
}
|
|
63
52
|
};
|
|
64
|
-
|
|
65
53
|
function useLocalStorage(key, defaultValue) {
|
|
66
54
|
const [value, setValue] = React__namespace.useState();
|
|
67
55
|
React__namespace.useEffect(() => {
|
|
68
56
|
const initialValue = getItem(key);
|
|
69
|
-
|
|
70
57
|
if (typeof initialValue === 'undefined' || initialValue === null) {
|
|
71
58
|
setValue(typeof defaultValue === 'function' ? defaultValue() : defaultValue);
|
|
72
59
|
} else {
|
|
@@ -76,15 +63,12 @@ function useLocalStorage(key, defaultValue) {
|
|
|
76
63
|
const setter = React__namespace.useCallback(updater => {
|
|
77
64
|
setValue(old => {
|
|
78
65
|
let newVal = updater;
|
|
79
|
-
|
|
80
66
|
if (typeof updater == 'function') {
|
|
81
67
|
newVal = updater(old);
|
|
82
68
|
}
|
|
83
|
-
|
|
84
69
|
try {
|
|
85
70
|
localStorage.setItem(key, JSON.stringify(newVal));
|
|
86
71
|
} catch {}
|
|
87
|
-
|
|
88
72
|
return newVal;
|
|
89
73
|
});
|
|
90
74
|
}, [key]);
|
|
@@ -124,27 +108,27 @@ function useMediaQuery(query) {
|
|
|
124
108
|
if (typeof window !== 'undefined') {
|
|
125
109
|
return window.matchMedia(query).matches;
|
|
126
110
|
}
|
|
127
|
-
|
|
128
111
|
return;
|
|
129
|
-
});
|
|
112
|
+
});
|
|
130
113
|
|
|
114
|
+
// Watch for changes
|
|
131
115
|
React__namespace.useEffect(() => {
|
|
132
116
|
if (typeof window !== 'undefined') {
|
|
133
117
|
// Create a matcher
|
|
134
|
-
const matcher = window.matchMedia(query);
|
|
118
|
+
const matcher = window.matchMedia(query);
|
|
135
119
|
|
|
120
|
+
// Create our handler
|
|
136
121
|
const onChange = ({
|
|
137
122
|
matches
|
|
138
|
-
}) => setIsMatch(matches);
|
|
139
|
-
|
|
123
|
+
}) => setIsMatch(matches);
|
|
140
124
|
|
|
125
|
+
// Listen for changes
|
|
141
126
|
matcher.addListener(onChange);
|
|
142
127
|
return () => {
|
|
143
128
|
// Stop listening for changes
|
|
144
129
|
matcher.removeListener(onChange);
|
|
145
130
|
};
|
|
146
131
|
}
|
|
147
|
-
|
|
148
132
|
return;
|
|
149
133
|
}, [isMatch, query, setIsMatch]);
|
|
150
134
|
return isMatch;
|
|
@@ -169,12 +153,15 @@ function styled(type, newStyles, queries = {}) {
|
|
|
169
153
|
const theme = useTheme();
|
|
170
154
|
const mediaStyles = Object.entries(queries).reduce((current, [key, value]) => {
|
|
171
155
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
172
|
-
return useMediaQuery(key) ? {
|
|
156
|
+
return useMediaQuery(key) ? {
|
|
157
|
+
...current,
|
|
173
158
|
...(typeof value === 'function' ? value(rest, theme) : value)
|
|
174
159
|
} : current;
|
|
175
160
|
}, {});
|
|
176
|
-
return /*#__PURE__*/React__namespace.createElement(type, {
|
|
177
|
-
|
|
161
|
+
return /*#__PURE__*/React__namespace.createElement(type, {
|
|
162
|
+
...rest,
|
|
163
|
+
style: {
|
|
164
|
+
...(typeof newStyles === 'function' ? newStyles(rest, theme) : newStyles),
|
|
178
165
|
...style,
|
|
179
166
|
...mediaStyles
|
|
180
167
|
},
|
|
@@ -193,33 +180,30 @@ function useIsMounted() {
|
|
|
193
180
|
}, []);
|
|
194
181
|
return isMounted;
|
|
195
182
|
}
|
|
183
|
+
|
|
196
184
|
/**
|
|
197
185
|
* Displays a string regardless the type of the data
|
|
198
186
|
* @param {unknown} value Value to be stringified
|
|
199
187
|
* @param {boolean} beautify Formats json to multiline
|
|
200
188
|
*/
|
|
201
|
-
|
|
202
189
|
const displayValue = (value, beautify = false) => {
|
|
203
190
|
const {
|
|
204
191
|
json
|
|
205
|
-
} =
|
|
192
|
+
} = SuperJSON.serialize(value);
|
|
206
193
|
return JSON.stringify(json, null, beautify ? 2 : undefined);
|
|
207
|
-
};
|
|
194
|
+
};
|
|
208
195
|
|
|
209
|
-
|
|
196
|
+
// Sorting functions
|
|
210
197
|
|
|
198
|
+
const getStatusRank = q => q.state.fetchStatus !== 'idle' ? 0 : !q.getObserversCount() ? 3 : q.isStale() ? 2 : 1;
|
|
211
199
|
const queryHashSort = (a, b) => a.queryHash.localeCompare(b.queryHash);
|
|
212
|
-
|
|
213
200
|
const dateSort = (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1;
|
|
214
|
-
|
|
215
201
|
const statusAndDateSort = (a, b) => {
|
|
216
202
|
if (getStatusRank(a) === getStatusRank(b)) {
|
|
217
203
|
return dateSort(a, b);
|
|
218
204
|
}
|
|
219
|
-
|
|
220
205
|
return getStatusRank(a) > getStatusRank(b) ? 1 : -1;
|
|
221
206
|
};
|
|
222
|
-
|
|
223
207
|
const sortFns = {
|
|
224
208
|
'Status > Last Updated': statusAndDateSort,
|
|
225
209
|
'Query Hash': queryHashSort,
|
|
@@ -233,7 +217,6 @@ const sides = {
|
|
|
233
217
|
left: 'right',
|
|
234
218
|
right: 'left'
|
|
235
219
|
};
|
|
236
|
-
|
|
237
220
|
/**
|
|
238
221
|
* Check if the given side is vertical (left/right)
|
|
239
222
|
*/
|
|
@@ -243,7 +226,6 @@ function isVerticalSide(side) {
|
|
|
243
226
|
/**
|
|
244
227
|
* Get the opposite side, eg 'left' => 'right'. 'top' => 'bottom', etc
|
|
245
228
|
*/
|
|
246
|
-
|
|
247
229
|
function getOppositeSide(side) {
|
|
248
230
|
return sides[side];
|
|
249
231
|
}
|
|
@@ -251,9 +233,8 @@ function getOppositeSide(side) {
|
|
|
251
233
|
* Given as css prop it will return a sided css prop based on a given side
|
|
252
234
|
* Example given `border` and `right` it return `borderRight`
|
|
253
235
|
*/
|
|
254
|
-
|
|
255
236
|
function getSidedProp(prop, side) {
|
|
256
|
-
return
|
|
237
|
+
return `${prop}${side.charAt(0).toUpperCase() + side.slice(1)}`;
|
|
257
238
|
}
|
|
258
239
|
function getSidePanelStyle({
|
|
259
240
|
position = 'bottom',
|
|
@@ -267,29 +248,30 @@ function getSidePanelStyle({
|
|
|
267
248
|
const oppositeSide = getOppositeSide(position);
|
|
268
249
|
const borderSide = getSidedProp('border', oppositeSide);
|
|
269
250
|
const isVertical = isVerticalSide(position);
|
|
270
|
-
return {
|
|
251
|
+
return {
|
|
252
|
+
...panelStyle,
|
|
271
253
|
direction: 'ltr',
|
|
272
254
|
position: 'fixed',
|
|
273
255
|
[position]: 0,
|
|
274
|
-
[borderSide]:
|
|
256
|
+
[borderSide]: `1px solid ${devtoolsTheme.gray}`,
|
|
275
257
|
transformOrigin: oppositeSide,
|
|
276
258
|
boxShadow: '0 0 20px rgba(0,0,0,.3)',
|
|
277
259
|
zIndex: 99999,
|
|
278
260
|
// visibility will be toggled after transitions, but set initial state here
|
|
279
261
|
visibility: isOpen ? 'visible' : 'hidden',
|
|
280
262
|
...(isResizing ? {
|
|
281
|
-
transition:
|
|
263
|
+
transition: `none`
|
|
282
264
|
} : {
|
|
283
|
-
transition:
|
|
265
|
+
transition: `all .2s ease`
|
|
284
266
|
}),
|
|
285
267
|
...(isOpen ? {
|
|
286
268
|
opacity: 1,
|
|
287
269
|
pointerEvents: 'all',
|
|
288
|
-
transform: isVertical ?
|
|
270
|
+
transform: isVertical ? `translateX(0) scale(1)` : `translateY(0) scale(1)`
|
|
289
271
|
} : {
|
|
290
272
|
opacity: 0,
|
|
291
273
|
pointerEvents: 'none',
|
|
292
|
-
transform: isVertical ?
|
|
274
|
+
transform: isVertical ? `translateX(15px) scale(1.02)` : `translateY(15px) scale(1.02)`
|
|
293
275
|
}),
|
|
294
276
|
...(isVertical ? {
|
|
295
277
|
top: 0,
|
|
@@ -304,10 +286,10 @@ function getSidePanelStyle({
|
|
|
304
286
|
})
|
|
305
287
|
};
|
|
306
288
|
}
|
|
289
|
+
|
|
307
290
|
/**
|
|
308
291
|
* Get resize handle style based on a given side
|
|
309
292
|
*/
|
|
310
|
-
|
|
311
293
|
function getResizeHandleStyle(position = 'bottom') {
|
|
312
294
|
const isVertical = isVerticalSide(position);
|
|
313
295
|
const oppositeSide = getOppositeSide(position);
|
|
@@ -317,7 +299,7 @@ function getResizeHandleStyle(position = 'bottom') {
|
|
|
317
299
|
cursor: isVertical ? 'col-resize' : 'row-resize',
|
|
318
300
|
zIndex: 100000,
|
|
319
301
|
[oppositeSide]: 0,
|
|
320
|
-
[marginSide]:
|
|
302
|
+
[marginSide]: `-4px`,
|
|
321
303
|
...(isVertical ? {
|
|
322
304
|
top: 0,
|
|
323
305
|
height: '100%',
|
|
@@ -331,7 +313,7 @@ function getResizeHandleStyle(position = 'bottom') {
|
|
|
331
313
|
|
|
332
314
|
const Panel = styled('div', (_props, theme) => ({
|
|
333
315
|
fontSize: 'clamp(12px, 1.5vw, 14px)',
|
|
334
|
-
fontFamily:
|
|
316
|
+
fontFamily: `sans-serif`,
|
|
335
317
|
display: 'flex',
|
|
336
318
|
backgroundColor: theme.background,
|
|
337
319
|
color: theme.foreground
|
|
@@ -340,10 +322,11 @@ const Panel = styled('div', (_props, theme) => ({
|
|
|
340
322
|
flexDirection: 'column'
|
|
341
323
|
},
|
|
342
324
|
'(max-width: 600px)': {
|
|
343
|
-
fontSize: '.9em'
|
|
344
|
-
|
|
325
|
+
fontSize: '.9em'
|
|
326
|
+
// flexDirection: 'column',
|
|
345
327
|
}
|
|
346
328
|
});
|
|
329
|
+
|
|
347
330
|
const ActiveQueryPanel = styled('div', () => ({
|
|
348
331
|
flex: '1 1 500px',
|
|
349
332
|
display: 'flex',
|
|
@@ -352,7 +335,7 @@ const ActiveQueryPanel = styled('div', () => ({
|
|
|
352
335
|
height: '100%'
|
|
353
336
|
}), {
|
|
354
337
|
'(max-width: 700px)': (_props, theme) => ({
|
|
355
|
-
borderTop:
|
|
338
|
+
borderTop: `2px solid ${theme.gray}`
|
|
356
339
|
})
|
|
357
340
|
});
|
|
358
341
|
const Button = styled('button', (props, theme) => ({
|
|
@@ -390,26 +373,26 @@ const Input = styled('input', (_props, theme) => ({
|
|
|
390
373
|
borderRadius: '.2em',
|
|
391
374
|
color: theme.inputTextColor,
|
|
392
375
|
fontSize: '.9em',
|
|
393
|
-
lineHeight:
|
|
376
|
+
lineHeight: `1.3`,
|
|
394
377
|
padding: '.3em .4em'
|
|
395
378
|
}));
|
|
396
379
|
const Select = styled('select', (_props, theme) => ({
|
|
397
|
-
display:
|
|
398
|
-
fontSize:
|
|
399
|
-
fontFamily:
|
|
380
|
+
display: `inline-block`,
|
|
381
|
+
fontSize: `.9em`,
|
|
382
|
+
fontFamily: `sans-serif`,
|
|
400
383
|
fontWeight: 'normal',
|
|
401
|
-
lineHeight:
|
|
402
|
-
padding:
|
|
384
|
+
lineHeight: `1.3`,
|
|
385
|
+
padding: `.3em 1.5em .3em .5em`,
|
|
403
386
|
height: 'auto',
|
|
404
387
|
border: 0,
|
|
405
|
-
borderRadius:
|
|
406
|
-
appearance:
|
|
388
|
+
borderRadius: `.2em`,
|
|
389
|
+
appearance: `none`,
|
|
407
390
|
WebkitAppearance: 'none',
|
|
408
391
|
backgroundColor: theme.inputBackgroundColor,
|
|
409
|
-
backgroundImage:
|
|
410
|
-
backgroundRepeat:
|
|
411
|
-
backgroundPosition:
|
|
412
|
-
backgroundSize:
|
|
392
|
+
backgroundImage: `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>")`,
|
|
393
|
+
backgroundRepeat: `no-repeat`,
|
|
394
|
+
backgroundPosition: `right .55em center`,
|
|
395
|
+
backgroundSize: `.65em auto, 100%`,
|
|
413
396
|
color: theme.inputTextColor
|
|
414
397
|
}), {
|
|
415
398
|
'(max-width: 500px)': {
|
|
@@ -459,7 +442,7 @@ const CopyButton = ({
|
|
|
459
442
|
const [copyState, setCopyState] = React__namespace.useState('NoCopy');
|
|
460
443
|
return /*#__PURE__*/React__namespace.createElement("button", {
|
|
461
444
|
onClick: copyState === 'NoCopy' ? () => {
|
|
462
|
-
navigator.clipboard.writeText(
|
|
445
|
+
navigator.clipboard.writeText(SuperJSON.stringify(value)).then(() => {
|
|
463
446
|
setCopyState('SuccessCopy');
|
|
464
447
|
setTimeout(() => {
|
|
465
448
|
setCopyState('NoCopy');
|
|
@@ -502,11 +485,10 @@ const Expander = ({
|
|
|
502
485
|
style: {
|
|
503
486
|
display: 'inline-block',
|
|
504
487
|
transition: 'all .1s ease',
|
|
505
|
-
transform:
|
|
488
|
+
transform: `rotate(${expanded ? 90 : 0}deg) ${style.transform || ''}`,
|
|
506
489
|
...style
|
|
507
490
|
}
|
|
508
491
|
}, "\u25B6");
|
|
509
|
-
|
|
510
492
|
const Copier = () => /*#__PURE__*/React__namespace.createElement("span", {
|
|
511
493
|
"aria-label": "Copy object to clipboard",
|
|
512
494
|
title: "Copy object to clipboard",
|
|
@@ -524,7 +506,6 @@ const Copier = () => /*#__PURE__*/React__namespace.createElement("span", {
|
|
|
524
506
|
fill: "currentColor",
|
|
525
507
|
d: "M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"
|
|
526
508
|
})));
|
|
527
|
-
|
|
528
509
|
const ErrorCopier = () => /*#__PURE__*/React__namespace.createElement("span", {
|
|
529
510
|
"aria-label": "Failed copying to clipboard",
|
|
530
511
|
title: "Failed copying to clipboard",
|
|
@@ -550,7 +531,6 @@ const ErrorCopier = () => /*#__PURE__*/React__namespace.createElement("span", {
|
|
|
550
531
|
top: '2px'
|
|
551
532
|
}
|
|
552
533
|
}, "See console"));
|
|
553
|
-
|
|
554
534
|
const CopiedCopier = () => /*#__PURE__*/React__namespace.createElement("span", {
|
|
555
535
|
"aria-label": "Object copied to clipboard",
|
|
556
536
|
title: "Object copied to clipboard",
|
|
@@ -568,7 +548,6 @@ const CopiedCopier = () => /*#__PURE__*/React__namespace.createElement("span", {
|
|
|
568
548
|
fill: "green",
|
|
569
549
|
d: "M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"
|
|
570
550
|
})));
|
|
571
|
-
|
|
572
551
|
/**
|
|
573
552
|
* Chunk elements in the array by size
|
|
574
553
|
*
|
|
@@ -582,12 +561,10 @@ function chunkArray(array, size) {
|
|
|
582
561
|
if (size < 1) return [];
|
|
583
562
|
let i = 0;
|
|
584
563
|
const result = [];
|
|
585
|
-
|
|
586
564
|
while (i < array.length) {
|
|
587
565
|
result.push(array.slice(i, i + size));
|
|
588
566
|
i = i + size;
|
|
589
567
|
}
|
|
590
|
-
|
|
591
568
|
return result;
|
|
592
569
|
}
|
|
593
570
|
const DefaultRenderer = ({
|
|
@@ -609,7 +586,7 @@ const DefaultRenderer = ({
|
|
|
609
586
|
onClick: () => toggleExpanded()
|
|
610
587
|
}, /*#__PURE__*/React__namespace.createElement(Expander, {
|
|
611
588
|
expanded: expanded
|
|
612
|
-
}), " ", label, ' ', /*#__PURE__*/React__namespace.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ?
|
|
589
|
+
}), " ", label, ' ', /*#__PURE__*/React__namespace.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ? `items` : `item`)), copyable ? /*#__PURE__*/React__namespace.createElement(CopyButton, {
|
|
613
590
|
value: value
|
|
614
591
|
}) : null, expanded ? subEntryPages.length === 1 ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, subEntries.map(handleEntry)) : /*#__PURE__*/React__namespace.createElement(SubEntries, null, subEntryPages.map((entries, index) => /*#__PURE__*/React__namespace.createElement("div", {
|
|
615
592
|
key: index
|
|
@@ -619,11 +596,9 @@ const DefaultRenderer = ({
|
|
|
619
596
|
expanded: expanded
|
|
620
597
|
}), " [", index * pageSize, " ...", ' ', index * pageSize + pageSize - 1, "]"), expandedPages.includes(index) ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, entries.map(handleEntry)) : null)))) : null) : /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Label, null, label, ":"), " ", /*#__PURE__*/React__namespace.createElement(Value, null, displayValue(value))));
|
|
621
598
|
};
|
|
622
|
-
|
|
623
599
|
function isIterable(x) {
|
|
624
600
|
return Symbol.iterator in x;
|
|
625
601
|
}
|
|
626
|
-
|
|
627
602
|
function Explorer({
|
|
628
603
|
value,
|
|
629
604
|
defaultExpanded,
|
|
@@ -636,16 +611,15 @@ function Explorer({
|
|
|
636
611
|
const toggleExpanded = React__namespace.useCallback(() => setExpanded(old => !old), []);
|
|
637
612
|
let type = typeof value;
|
|
638
613
|
let subEntries = [];
|
|
639
|
-
|
|
640
614
|
const makeProperty = sub => {
|
|
641
615
|
const subDefaultExpanded = defaultExpanded === true ? {
|
|
642
616
|
[sub.label]: true
|
|
643
|
-
} : defaultExpanded
|
|
644
|
-
return {
|
|
617
|
+
} : defaultExpanded?.[sub.label];
|
|
618
|
+
return {
|
|
619
|
+
...sub,
|
|
645
620
|
defaultExpanded: subDefaultExpanded
|
|
646
621
|
};
|
|
647
622
|
};
|
|
648
|
-
|
|
649
623
|
if (Array.isArray(value)) {
|
|
650
624
|
type = 'array';
|
|
651
625
|
subEntries = value.map((d, i) => makeProperty({
|
|
@@ -665,7 +639,6 @@ function Explorer({
|
|
|
665
639
|
value: val
|
|
666
640
|
}));
|
|
667
641
|
}
|
|
668
|
-
|
|
669
642
|
const subEntryPages = chunkArray(subEntries, pageSize);
|
|
670
643
|
return renderer({
|
|
671
644
|
handleEntry: entry => /*#__PURE__*/React__namespace.createElement(Explorer, _extends({
|
|
@@ -720,7 +693,7 @@ function ReactQueryDevtools$1({
|
|
|
720
693
|
toggleButtonProps = {},
|
|
721
694
|
position = 'bottom-left',
|
|
722
695
|
containerElement: Container = 'aside',
|
|
723
|
-
|
|
696
|
+
queryClient,
|
|
724
697
|
styleNonce,
|
|
725
698
|
panelPosition: initialPanelPosition = 'bottom'
|
|
726
699
|
}) {
|
|
@@ -733,11 +706,9 @@ function ReactQueryDevtools$1({
|
|
|
733
706
|
const [isResolvedOpen, setIsResolvedOpen] = React__namespace.useState(false);
|
|
734
707
|
const [isResizing, setIsResizing] = React__namespace.useState(false);
|
|
735
708
|
const isMounted = useIsMounted();
|
|
736
|
-
|
|
737
709
|
const handleDragStart = (panelElement, startEvent) => {
|
|
738
710
|
if (!panelElement) return;
|
|
739
711
|
if (startEvent.button !== 0) return; // Only allow left click for drag
|
|
740
|
-
|
|
741
712
|
const isVertical = isVerticalSide(panelPosition);
|
|
742
713
|
setIsResizing(true);
|
|
743
714
|
const {
|
|
@@ -747,12 +718,12 @@ function ReactQueryDevtools$1({
|
|
|
747
718
|
const startX = startEvent.clientX;
|
|
748
719
|
const startY = startEvent.clientY;
|
|
749
720
|
let newSize = 0;
|
|
750
|
-
|
|
751
721
|
const run = moveEvent => {
|
|
752
722
|
// prevent mouse selecting stuff with mouse drag
|
|
753
|
-
moveEvent.preventDefault();
|
|
754
|
-
// hint: it is different formula for the opposite sides
|
|
723
|
+
moveEvent.preventDefault();
|
|
755
724
|
|
|
725
|
+
// calculate the correct size based on mouse position and current panel position
|
|
726
|
+
// hint: it is different formula for the opposite sides
|
|
756
727
|
if (isVertical) {
|
|
757
728
|
newSize = width + (panelPosition === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX);
|
|
758
729
|
setDevtoolsWidth(newSize);
|
|
@@ -760,48 +731,41 @@ function ReactQueryDevtools$1({
|
|
|
760
731
|
newSize = height + (panelPosition === 'bottom' ? startY - moveEvent.clientY : moveEvent.clientY - startY);
|
|
761
732
|
setDevtoolsHeight(newSize);
|
|
762
733
|
}
|
|
763
|
-
|
|
764
734
|
if (newSize < minPanelSize) {
|
|
765
735
|
setIsOpen(false);
|
|
766
736
|
} else {
|
|
767
737
|
setIsOpen(true);
|
|
768
738
|
}
|
|
769
739
|
};
|
|
770
|
-
|
|
771
740
|
const unsub = () => {
|
|
772
741
|
if (isResizing) {
|
|
773
742
|
setIsResizing(false);
|
|
774
743
|
}
|
|
775
|
-
|
|
776
744
|
document.removeEventListener('mousemove', run, false);
|
|
777
745
|
document.removeEventListener('mouseUp', unsub, false);
|
|
778
746
|
};
|
|
779
|
-
|
|
780
747
|
document.addEventListener('mousemove', run, false);
|
|
781
748
|
document.addEventListener('mouseup', unsub, false);
|
|
782
749
|
};
|
|
783
|
-
|
|
784
750
|
React__namespace.useEffect(() => {
|
|
785
|
-
setIsResolvedOpen(isOpen
|
|
786
|
-
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
787
|
-
// Prevents focusing in a closed panel.
|
|
751
|
+
setIsResolvedOpen(isOpen ?? false);
|
|
752
|
+
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
788
753
|
|
|
754
|
+
// Toggle panel visibility before/after transition (depending on direction).
|
|
755
|
+
// Prevents focusing in a closed panel.
|
|
789
756
|
React__namespace.useEffect(() => {
|
|
790
757
|
const ref = panelRef.current;
|
|
791
|
-
|
|
792
758
|
if (ref) {
|
|
793
759
|
const handlePanelTransitionStart = () => {
|
|
794
760
|
if (isResolvedOpen) {
|
|
795
761
|
ref.style.visibility = 'visible';
|
|
796
762
|
}
|
|
797
763
|
};
|
|
798
|
-
|
|
799
764
|
const handlePanelTransitionEnd = () => {
|
|
800
765
|
if (!isResolvedOpen) {
|
|
801
766
|
ref.style.visibility = 'hidden';
|
|
802
767
|
}
|
|
803
768
|
};
|
|
804
|
-
|
|
805
769
|
ref.addEventListener('transitionstart', handlePanelTransitionStart);
|
|
806
770
|
ref.addEventListener('transitionend', handlePanelTransitionEnd);
|
|
807
771
|
return () => {
|
|
@@ -809,19 +773,15 @@ function ReactQueryDevtools$1({
|
|
|
809
773
|
ref.removeEventListener('transitionend', handlePanelTransitionEnd);
|
|
810
774
|
};
|
|
811
775
|
}
|
|
812
|
-
|
|
813
776
|
return;
|
|
814
777
|
}, [isResolvedOpen]);
|
|
815
778
|
React__namespace.useEffect(() => {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
if (isResolvedOpen && (_rootRef$current = rootRef.current) != null && _rootRef$current.parentElement) {
|
|
779
|
+
if (isResolvedOpen && rootRef.current?.parentElement) {
|
|
819
780
|
const {
|
|
820
781
|
parentElement
|
|
821
782
|
} = rootRef.current;
|
|
822
783
|
const styleProp = getSidedProp('padding', panelPosition);
|
|
823
784
|
const isVertical = isVerticalSide(panelPosition);
|
|
824
|
-
|
|
825
785
|
const previousPaddings = (({
|
|
826
786
|
padding,
|
|
827
787
|
paddingTop,
|
|
@@ -835,20 +795,18 @@ function ReactQueryDevtools$1({
|
|
|
835
795
|
paddingLeft,
|
|
836
796
|
paddingRight
|
|
837
797
|
}))(parentElement.style);
|
|
838
|
-
|
|
839
798
|
const run = () => {
|
|
840
799
|
// reset the padding
|
|
841
800
|
parentElement.style.padding = '0px';
|
|
842
801
|
parentElement.style.paddingTop = '0px';
|
|
843
802
|
parentElement.style.paddingBottom = '0px';
|
|
844
803
|
parentElement.style.paddingLeft = '0px';
|
|
845
|
-
parentElement.style.paddingRight = '0px';
|
|
804
|
+
parentElement.style.paddingRight = '0px';
|
|
805
|
+
// set the new padding based on the new panel position
|
|
846
806
|
|
|
847
|
-
parentElement.style[styleProp] =
|
|
807
|
+
parentElement.style[styleProp] = `${isVertical ? devtoolsWidth : devtoolsHeight}px`;
|
|
848
808
|
};
|
|
849
|
-
|
|
850
809
|
run();
|
|
851
|
-
|
|
852
810
|
if (typeof window !== 'undefined') {
|
|
853
811
|
window.addEventListener('resize', run);
|
|
854
812
|
return () => {
|
|
@@ -859,7 +817,6 @@ function ReactQueryDevtools$1({
|
|
|
859
817
|
};
|
|
860
818
|
}
|
|
861
819
|
}
|
|
862
|
-
|
|
863
820
|
return;
|
|
864
821
|
}, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth]);
|
|
865
822
|
const {
|
|
@@ -870,8 +827,9 @@ function ReactQueryDevtools$1({
|
|
|
870
827
|
style: toggleButtonStyle = {},
|
|
871
828
|
onClick: onToggleClick,
|
|
872
829
|
...otherToggleButtonProps
|
|
873
|
-
} = toggleButtonProps;
|
|
830
|
+
} = toggleButtonProps;
|
|
874
831
|
|
|
832
|
+
// get computed style based on panel position
|
|
875
833
|
const style = getSidePanelStyle({
|
|
876
834
|
position: panelPosition,
|
|
877
835
|
devtoolsTheme: defaultTheme,
|
|
@@ -880,8 +838,9 @@ function ReactQueryDevtools$1({
|
|
|
880
838
|
width: devtoolsWidth,
|
|
881
839
|
isResizing,
|
|
882
840
|
panelStyle
|
|
883
|
-
});
|
|
841
|
+
});
|
|
884
842
|
|
|
843
|
+
// Do not render on the server
|
|
885
844
|
if (!isMounted()) return null;
|
|
886
845
|
return /*#__PURE__*/React__namespace.createElement(Container, {
|
|
887
846
|
ref: rootRef,
|
|
@@ -891,7 +850,7 @@ function ReactQueryDevtools$1({
|
|
|
891
850
|
theme: defaultTheme
|
|
892
851
|
}, /*#__PURE__*/React__namespace.createElement(ReactQueryDevtoolsPanel$1, _extends({
|
|
893
852
|
ref: panelRef,
|
|
894
|
-
|
|
853
|
+
queryClient: queryClient,
|
|
895
854
|
styleNonce: styleNonce,
|
|
896
855
|
position: panelPosition,
|
|
897
856
|
onPositionChange: setPanelPosition,
|
|
@@ -911,7 +870,7 @@ function ReactQueryDevtools$1({
|
|
|
911
870
|
"aria-expanded": "false",
|
|
912
871
|
onClick: e => {
|
|
913
872
|
setIsOpen(true);
|
|
914
|
-
onToggleClick
|
|
873
|
+
onToggleClick?.(e);
|
|
915
874
|
},
|
|
916
875
|
style: {
|
|
917
876
|
background: 'none',
|
|
@@ -945,22 +904,20 @@ function ReactQueryDevtools$1({
|
|
|
945
904
|
text: "Open React Query Devtools"
|
|
946
905
|
})) : null);
|
|
947
906
|
}
|
|
948
|
-
|
|
949
907
|
const useSubscribeToQueryCache = (queryCache, getSnapshot, skip = false) => {
|
|
950
|
-
return
|
|
908
|
+
return React__namespace.useSyncExternalStore(React__namespace.useCallback(onStoreChange => {
|
|
951
909
|
if (!skip) return queryCache.subscribe(reactQuery.notifyManager.batchCalls(onStoreChange));
|
|
952
910
|
return () => {
|
|
953
911
|
return;
|
|
954
912
|
};
|
|
955
913
|
}, [queryCache, skip]), getSnapshot, getSnapshot);
|
|
956
914
|
};
|
|
957
|
-
|
|
958
915
|
const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
|
|
959
916
|
const {
|
|
960
917
|
isOpen = true,
|
|
961
918
|
styleNonce,
|
|
962
919
|
setIsOpen,
|
|
963
|
-
|
|
920
|
+
queryClient,
|
|
964
921
|
onDragStart,
|
|
965
922
|
onPositionChange,
|
|
966
923
|
showCloseButton,
|
|
@@ -972,10 +929,8 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
972
929
|
onClick: onCloseClick,
|
|
973
930
|
...otherCloseButtonProps
|
|
974
931
|
} = closeButtonProps;
|
|
975
|
-
const
|
|
976
|
-
|
|
977
|
-
});
|
|
978
|
-
const queryCache = queryClient.getQueryCache();
|
|
932
|
+
const client = reactQuery.useQueryClient(queryClient);
|
|
933
|
+
const queryCache = client.getQueryCache();
|
|
979
934
|
const [sort, setSort] = useLocalStorage('reactQueryDevtoolsSortFn', Object.keys(sortFns)[0]);
|
|
980
935
|
const [filter, setFilter] = useLocalStorage('reactQueryDevtoolsFilter', '');
|
|
981
936
|
const [baseSort, setBaseSort] = useLocalStorage('reactQueryDevtoolsBaseSort', 1);
|
|
@@ -984,11 +939,9 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
984
939
|
const [activeQueryHash, setActiveQueryHash] = useLocalStorage('reactQueryDevtoolsActiveQueryHash', '');
|
|
985
940
|
const queries = React__namespace.useMemo(() => {
|
|
986
941
|
const unsortedQueries = queryCache.getAll();
|
|
987
|
-
|
|
988
942
|
if (queriesCount === 0) {
|
|
989
943
|
return [];
|
|
990
944
|
}
|
|
991
|
-
|
|
992
945
|
const filtered = filter ? unsortedQueries.filter(item => matchSorterUtils.rankItem(item.queryHash, filter).passed) : [...unsortedQueries];
|
|
993
946
|
const sorted = sortFn ? filtered.sort((a, b) => sortFn(a, b) * baseSort) : filtered;
|
|
994
947
|
return sorted;
|
|
@@ -1010,7 +963,26 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1010
963
|
}), /*#__PURE__*/React__namespace.createElement("style", {
|
|
1011
964
|
nonce: styleNonce,
|
|
1012
965
|
dangerouslySetInnerHTML: {
|
|
1013
|
-
__html:
|
|
966
|
+
__html: `
|
|
967
|
+
.ReactQueryDevtoolsPanel * {
|
|
968
|
+
scrollbar-color: ${defaultTheme.backgroundAlt} ${defaultTheme.gray};
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar, .ReactQueryDevtoolsPanel scrollbar {
|
|
972
|
+
width: 1em;
|
|
973
|
+
height: 1em;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar-track, .ReactQueryDevtoolsPanel scrollbar-track {
|
|
977
|
+
background: ${defaultTheme.backgroundAlt};
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar-thumb, .ReactQueryDevtoolsPanel scrollbar-thumb {
|
|
981
|
+
background: ${defaultTheme.gray};
|
|
982
|
+
border-radius: .5em;
|
|
983
|
+
border: 3px solid ${defaultTheme.backgroundAlt};
|
|
984
|
+
}
|
|
985
|
+
`
|
|
1014
986
|
}
|
|
1015
987
|
}), /*#__PURE__*/React__namespace.createElement("div", {
|
|
1016
988
|
style: getResizeHandleStyle(position),
|
|
@@ -1021,7 +993,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1021
993
|
minHeight: '40%',
|
|
1022
994
|
maxHeight: '100%',
|
|
1023
995
|
overflow: 'auto',
|
|
1024
|
-
borderRight:
|
|
996
|
+
borderRight: `1px solid ${defaultTheme.grayAlt}`,
|
|
1025
997
|
display: 'flex',
|
|
1026
998
|
flexDirection: 'column'
|
|
1027
999
|
}
|
|
@@ -1089,7 +1061,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1089
1061
|
}, /*#__PURE__*/React__namespace.createElement(Input, {
|
|
1090
1062
|
placeholder: "Filter",
|
|
1091
1063
|
"aria-label": "Filter by queryhash",
|
|
1092
|
-
value: filter
|
|
1064
|
+
value: filter ?? '',
|
|
1093
1065
|
onChange: e => setFilter(e.target.value),
|
|
1094
1066
|
onKeyDown: e => {
|
|
1095
1067
|
if (e.key === 'Escape') setFilter('');
|
|
@@ -1099,7 +1071,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1099
1071
|
marginRight: '.5em',
|
|
1100
1072
|
width: '100%'
|
|
1101
1073
|
}
|
|
1102
|
-
}),
|
|
1074
|
+
}), /*#__PURE__*/React__namespace.createElement(Select, {
|
|
1103
1075
|
"aria-label": "Sort queries",
|
|
1104
1076
|
value: sort,
|
|
1105
1077
|
onChange: e => setSort(e.target.value),
|
|
@@ -1180,7 +1152,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1180
1152
|
d: "M3.515 9.515c4.686 -4.687 12.284 -4.687 17 0"
|
|
1181
1153
|
}))), /*#__PURE__*/React__namespace.createElement(ScreenReader, {
|
|
1182
1154
|
text: isMockOffline ? 'Restore offline mock' : 'Mock offline behavior'
|
|
1183
|
-
})))
|
|
1155
|
+
}))))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
1184
1156
|
style: {
|
|
1185
1157
|
overflowY: 'auto',
|
|
1186
1158
|
flex: '1'
|
|
@@ -1196,7 +1168,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1196
1168
|
}))), activeQueryHash && isOpen ? /*#__PURE__*/React__namespace.createElement(ActiveQuery, {
|
|
1197
1169
|
activeQueryHash: activeQueryHash,
|
|
1198
1170
|
queryCache: queryCache,
|
|
1199
|
-
queryClient:
|
|
1171
|
+
queryClient: client
|
|
1200
1172
|
}) : null, showCloseButton ? /*#__PURE__*/React__namespace.createElement(Button, _extends({
|
|
1201
1173
|
type: "button",
|
|
1202
1174
|
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
@@ -1213,44 +1185,26 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1213
1185
|
},
|
|
1214
1186
|
onClick: e => {
|
|
1215
1187
|
setIsOpen(false);
|
|
1216
|
-
onCloseClick
|
|
1188
|
+
onCloseClick?.(e);
|
|
1217
1189
|
}
|
|
1218
1190
|
}), "Close") : null));
|
|
1219
1191
|
});
|
|
1220
|
-
|
|
1221
1192
|
const ActiveQuery = ({
|
|
1222
1193
|
queryCache,
|
|
1223
1194
|
activeQueryHash,
|
|
1224
1195
|
queryClient
|
|
1225
1196
|
}) => {
|
|
1226
|
-
var _useSubscribeToQueryC, _useSubscribeToQueryC2;
|
|
1227
|
-
|
|
1228
1197
|
const activeQuery = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash));
|
|
1229
|
-
const activeQueryState = useSubscribeToQueryCache(queryCache, () =>
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
return (_queryCache$getAll$fi = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi.state;
|
|
1233
|
-
});
|
|
1234
|
-
const isStale = (_useSubscribeToQueryC = useSubscribeToQueryCache(queryCache, () => {
|
|
1235
|
-
var _queryCache$getAll$fi2;
|
|
1236
|
-
|
|
1237
|
-
return (_queryCache$getAll$fi2 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi2.isStale();
|
|
1238
|
-
})) != null ? _useSubscribeToQueryC : false;
|
|
1239
|
-
const observerCount = (_useSubscribeToQueryC2 = useSubscribeToQueryCache(queryCache, () => {
|
|
1240
|
-
var _queryCache$getAll$fi3;
|
|
1241
|
-
|
|
1242
|
-
return (_queryCache$getAll$fi3 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi3.getObserversCount();
|
|
1243
|
-
})) != null ? _useSubscribeToQueryC2 : 0;
|
|
1244
|
-
|
|
1198
|
+
const activeQueryState = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.state);
|
|
1199
|
+
const isStale = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.isStale()) ?? false;
|
|
1200
|
+
const observerCount = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.getObserversCount()) ?? 0;
|
|
1245
1201
|
const handleRefetch = () => {
|
|
1246
|
-
const promise = activeQuery
|
|
1247
|
-
promise
|
|
1202
|
+
const promise = activeQuery?.fetch();
|
|
1203
|
+
promise?.catch(noop);
|
|
1248
1204
|
};
|
|
1249
|
-
|
|
1250
1205
|
if (!activeQuery || !activeQueryState) {
|
|
1251
1206
|
return null;
|
|
1252
1207
|
}
|
|
1253
|
-
|
|
1254
1208
|
return /*#__PURE__*/React__namespace.createElement(ActiveQueryPanel, null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
1255
1209
|
style: {
|
|
1256
1210
|
padding: '.5em',
|
|
@@ -1382,7 +1336,6 @@ const ActiveQuery = ({
|
|
|
1382
1336
|
}
|
|
1383
1337
|
})));
|
|
1384
1338
|
};
|
|
1385
|
-
|
|
1386
1339
|
const QueryStatusCount = ({
|
|
1387
1340
|
queryCache
|
|
1388
1341
|
}) => {
|
|
@@ -1420,52 +1373,37 @@ const QueryStatusCount = ({
|
|
|
1420
1373
|
}
|
|
1421
1374
|
}, "inactive ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasInactive, ")")));
|
|
1422
1375
|
};
|
|
1423
|
-
|
|
1424
1376
|
const QueryRow = /*#__PURE__*/React__namespace.memo(({
|
|
1425
1377
|
queryKey,
|
|
1426
1378
|
setActiveQueryHash,
|
|
1427
1379
|
activeQueryHash,
|
|
1428
1380
|
queryCache
|
|
1429
1381
|
}) => {
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
});
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
return (_queryCache$find3 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find3.isStale();
|
|
1446
|
-
})) != null ? _useSubscribeToQueryC4 : false;
|
|
1447
|
-
const isDisabled = (_useSubscribeToQueryC5 = useSubscribeToQueryCache(queryCache, () => {
|
|
1448
|
-
var _queryCache$find4;
|
|
1449
|
-
|
|
1450
|
-
return (_queryCache$find4 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find4.isDisabled();
|
|
1451
|
-
})) != null ? _useSubscribeToQueryC5 : false;
|
|
1452
|
-
const observerCount = (_useSubscribeToQueryC6 = useSubscribeToQueryCache(queryCache, () => {
|
|
1453
|
-
var _queryCache$find5;
|
|
1454
|
-
|
|
1455
|
-
return (_queryCache$find5 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find5.getObserversCount();
|
|
1456
|
-
})) != null ? _useSubscribeToQueryC6 : 0;
|
|
1457
|
-
|
|
1382
|
+
const queryHash = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1383
|
+
queryKey
|
|
1384
|
+
})?.queryHash) ?? '';
|
|
1385
|
+
const queryState = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1386
|
+
queryKey
|
|
1387
|
+
})?.state);
|
|
1388
|
+
const isStale = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1389
|
+
queryKey
|
|
1390
|
+
})?.isStale()) ?? false;
|
|
1391
|
+
const isDisabled = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1392
|
+
queryKey
|
|
1393
|
+
})?.isDisabled()) ?? false;
|
|
1394
|
+
const observerCount = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1395
|
+
queryKey
|
|
1396
|
+
})?.getObserversCount()) ?? 0;
|
|
1458
1397
|
if (!queryState) {
|
|
1459
1398
|
return null;
|
|
1460
1399
|
}
|
|
1461
|
-
|
|
1462
1400
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
1463
1401
|
role: "button",
|
|
1464
|
-
"aria-label":
|
|
1402
|
+
"aria-label": `Open query details for ${queryHash}`,
|
|
1465
1403
|
onClick: () => setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash),
|
|
1466
1404
|
style: {
|
|
1467
1405
|
display: 'flex',
|
|
1468
|
-
borderBottom:
|
|
1406
|
+
borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
|
|
1469
1407
|
cursor: 'pointer',
|
|
1470
1408
|
background: queryHash === activeQueryHash ? 'rgba(255,255,255,.1)' : undefined
|
|
1471
1409
|
}
|
|
@@ -1501,9 +1439,10 @@ const QueryRow = /*#__PURE__*/React__namespace.memo(({
|
|
|
1501
1439
|
style: {
|
|
1502
1440
|
padding: '.5em'
|
|
1503
1441
|
}
|
|
1504
|
-
},
|
|
1505
|
-
});
|
|
1442
|
+
}, `${queryHash}`));
|
|
1443
|
+
});
|
|
1506
1444
|
|
|
1445
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1507
1446
|
function noop() {}
|
|
1508
1447
|
|
|
1509
1448
|
const ReactQueryDevtools = ReactQueryDevtools$1;
|