@tanstack/react-query-devtools 4.24.10 → 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
|
@@ -2,20 +2,17 @@ import * as React from 'react';
|
|
|
2
2
|
import { useQueryClient, onlineManager, notifyManager } from '@tanstack/react-query';
|
|
3
3
|
import { rankItem } from '@tanstack/match-sorter-utils';
|
|
4
4
|
import SuperJSON from 'superjson';
|
|
5
|
-
import { useSyncExternalStore } from 'use-sync-external-store/shim/index.js';
|
|
6
5
|
|
|
7
6
|
function _extends() {
|
|
8
7
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
9
8
|
for (var i = 1; i < arguments.length; i++) {
|
|
10
9
|
var source = arguments[i];
|
|
11
|
-
|
|
12
10
|
for (var key in source) {
|
|
13
11
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
14
12
|
target[key] = source[key];
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
return target;
|
|
20
17
|
};
|
|
21
18
|
return _extends.apply(this, arguments);
|
|
@@ -24,22 +21,18 @@ function _extends() {
|
|
|
24
21
|
const getItem = key => {
|
|
25
22
|
try {
|
|
26
23
|
const itemValue = localStorage.getItem(key);
|
|
27
|
-
|
|
28
24
|
if (typeof itemValue === 'string') {
|
|
29
25
|
return JSON.parse(itemValue);
|
|
30
26
|
}
|
|
31
|
-
|
|
32
27
|
return undefined;
|
|
33
28
|
} catch {
|
|
34
29
|
return undefined;
|
|
35
30
|
}
|
|
36
31
|
};
|
|
37
|
-
|
|
38
32
|
function useLocalStorage(key, defaultValue) {
|
|
39
33
|
const [value, setValue] = React.useState();
|
|
40
34
|
React.useEffect(() => {
|
|
41
35
|
const initialValue = getItem(key);
|
|
42
|
-
|
|
43
36
|
if (typeof initialValue === 'undefined' || initialValue === null) {
|
|
44
37
|
setValue(typeof defaultValue === 'function' ? defaultValue() : defaultValue);
|
|
45
38
|
} else {
|
|
@@ -49,15 +42,12 @@ function useLocalStorage(key, defaultValue) {
|
|
|
49
42
|
const setter = React.useCallback(updater => {
|
|
50
43
|
setValue(old => {
|
|
51
44
|
let newVal = updater;
|
|
52
|
-
|
|
53
45
|
if (typeof updater == 'function') {
|
|
54
46
|
newVal = updater(old);
|
|
55
47
|
}
|
|
56
|
-
|
|
57
48
|
try {
|
|
58
49
|
localStorage.setItem(key, JSON.stringify(newVal));
|
|
59
50
|
} catch {}
|
|
60
|
-
|
|
61
51
|
return newVal;
|
|
62
52
|
});
|
|
63
53
|
}, [key]);
|
|
@@ -97,27 +87,27 @@ function useMediaQuery(query) {
|
|
|
97
87
|
if (typeof window !== 'undefined') {
|
|
98
88
|
return window.matchMedia(query).matches;
|
|
99
89
|
}
|
|
100
|
-
|
|
101
90
|
return;
|
|
102
|
-
});
|
|
91
|
+
});
|
|
103
92
|
|
|
93
|
+
// Watch for changes
|
|
104
94
|
React.useEffect(() => {
|
|
105
95
|
if (typeof window !== 'undefined') {
|
|
106
96
|
// Create a matcher
|
|
107
|
-
const matcher = window.matchMedia(query);
|
|
97
|
+
const matcher = window.matchMedia(query);
|
|
108
98
|
|
|
99
|
+
// Create our handler
|
|
109
100
|
const onChange = ({
|
|
110
101
|
matches
|
|
111
|
-
}) => setIsMatch(matches);
|
|
112
|
-
|
|
102
|
+
}) => setIsMatch(matches);
|
|
113
103
|
|
|
104
|
+
// Listen for changes
|
|
114
105
|
matcher.addListener(onChange);
|
|
115
106
|
return () => {
|
|
116
107
|
// Stop listening for changes
|
|
117
108
|
matcher.removeListener(onChange);
|
|
118
109
|
};
|
|
119
110
|
}
|
|
120
|
-
|
|
121
111
|
return;
|
|
122
112
|
}, [isMatch, query, setIsMatch]);
|
|
123
113
|
return isMatch;
|
|
@@ -142,12 +132,15 @@ function styled(type, newStyles, queries = {}) {
|
|
|
142
132
|
const theme = useTheme();
|
|
143
133
|
const mediaStyles = Object.entries(queries).reduce((current, [key, value]) => {
|
|
144
134
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
145
|
-
return useMediaQuery(key) ? {
|
|
135
|
+
return useMediaQuery(key) ? {
|
|
136
|
+
...current,
|
|
146
137
|
...(typeof value === 'function' ? value(rest, theme) : value)
|
|
147
138
|
} : current;
|
|
148
139
|
}, {});
|
|
149
|
-
return /*#__PURE__*/React.createElement(type, {
|
|
150
|
-
|
|
140
|
+
return /*#__PURE__*/React.createElement(type, {
|
|
141
|
+
...rest,
|
|
142
|
+
style: {
|
|
143
|
+
...(typeof newStyles === 'function' ? newStyles(rest, theme) : newStyles),
|
|
151
144
|
...style,
|
|
152
145
|
...mediaStyles
|
|
153
146
|
},
|
|
@@ -166,33 +159,30 @@ function useIsMounted() {
|
|
|
166
159
|
}, []);
|
|
167
160
|
return isMounted;
|
|
168
161
|
}
|
|
162
|
+
|
|
169
163
|
/**
|
|
170
164
|
* Displays a string regardless the type of the data
|
|
171
165
|
* @param {unknown} value Value to be stringified
|
|
172
166
|
* @param {boolean} beautify Formats json to multiline
|
|
173
167
|
*/
|
|
174
|
-
|
|
175
168
|
const displayValue = (value, beautify = false) => {
|
|
176
169
|
const {
|
|
177
170
|
json
|
|
178
171
|
} = SuperJSON.serialize(value);
|
|
179
172
|
return JSON.stringify(json, null, beautify ? 2 : undefined);
|
|
180
|
-
};
|
|
173
|
+
};
|
|
181
174
|
|
|
182
|
-
|
|
175
|
+
// Sorting functions
|
|
183
176
|
|
|
177
|
+
const getStatusRank = q => q.state.fetchStatus !== 'idle' ? 0 : !q.getObserversCount() ? 3 : q.isStale() ? 2 : 1;
|
|
184
178
|
const queryHashSort = (a, b) => a.queryHash.localeCompare(b.queryHash);
|
|
185
|
-
|
|
186
179
|
const dateSort = (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1;
|
|
187
|
-
|
|
188
180
|
const statusAndDateSort = (a, b) => {
|
|
189
181
|
if (getStatusRank(a) === getStatusRank(b)) {
|
|
190
182
|
return dateSort(a, b);
|
|
191
183
|
}
|
|
192
|
-
|
|
193
184
|
return getStatusRank(a) > getStatusRank(b) ? 1 : -1;
|
|
194
185
|
};
|
|
195
|
-
|
|
196
186
|
const sortFns = {
|
|
197
187
|
'Status > Last Updated': statusAndDateSort,
|
|
198
188
|
'Query Hash': queryHashSort,
|
|
@@ -206,7 +196,6 @@ const sides = {
|
|
|
206
196
|
left: 'right',
|
|
207
197
|
right: 'left'
|
|
208
198
|
};
|
|
209
|
-
|
|
210
199
|
/**
|
|
211
200
|
* Check if the given side is vertical (left/right)
|
|
212
201
|
*/
|
|
@@ -216,7 +205,6 @@ function isVerticalSide(side) {
|
|
|
216
205
|
/**
|
|
217
206
|
* Get the opposite side, eg 'left' => 'right'. 'top' => 'bottom', etc
|
|
218
207
|
*/
|
|
219
|
-
|
|
220
208
|
function getOppositeSide(side) {
|
|
221
209
|
return sides[side];
|
|
222
210
|
}
|
|
@@ -224,9 +212,8 @@ function getOppositeSide(side) {
|
|
|
224
212
|
* Given as css prop it will return a sided css prop based on a given side
|
|
225
213
|
* Example given `border` and `right` it return `borderRight`
|
|
226
214
|
*/
|
|
227
|
-
|
|
228
215
|
function getSidedProp(prop, side) {
|
|
229
|
-
return
|
|
216
|
+
return `${prop}${side.charAt(0).toUpperCase() + side.slice(1)}`;
|
|
230
217
|
}
|
|
231
218
|
function getSidePanelStyle({
|
|
232
219
|
position = 'bottom',
|
|
@@ -240,29 +227,30 @@ function getSidePanelStyle({
|
|
|
240
227
|
const oppositeSide = getOppositeSide(position);
|
|
241
228
|
const borderSide = getSidedProp('border', oppositeSide);
|
|
242
229
|
const isVertical = isVerticalSide(position);
|
|
243
|
-
return {
|
|
230
|
+
return {
|
|
231
|
+
...panelStyle,
|
|
244
232
|
direction: 'ltr',
|
|
245
233
|
position: 'fixed',
|
|
246
234
|
[position]: 0,
|
|
247
|
-
[borderSide]:
|
|
235
|
+
[borderSide]: `1px solid ${devtoolsTheme.gray}`,
|
|
248
236
|
transformOrigin: oppositeSide,
|
|
249
237
|
boxShadow: '0 0 20px rgba(0,0,0,.3)',
|
|
250
238
|
zIndex: 99999,
|
|
251
239
|
// visibility will be toggled after transitions, but set initial state here
|
|
252
240
|
visibility: isOpen ? 'visible' : 'hidden',
|
|
253
241
|
...(isResizing ? {
|
|
254
|
-
transition:
|
|
242
|
+
transition: `none`
|
|
255
243
|
} : {
|
|
256
|
-
transition:
|
|
244
|
+
transition: `all .2s ease`
|
|
257
245
|
}),
|
|
258
246
|
...(isOpen ? {
|
|
259
247
|
opacity: 1,
|
|
260
248
|
pointerEvents: 'all',
|
|
261
|
-
transform: isVertical ?
|
|
249
|
+
transform: isVertical ? `translateX(0) scale(1)` : `translateY(0) scale(1)`
|
|
262
250
|
} : {
|
|
263
251
|
opacity: 0,
|
|
264
252
|
pointerEvents: 'none',
|
|
265
|
-
transform: isVertical ?
|
|
253
|
+
transform: isVertical ? `translateX(15px) scale(1.02)` : `translateY(15px) scale(1.02)`
|
|
266
254
|
}),
|
|
267
255
|
...(isVertical ? {
|
|
268
256
|
top: 0,
|
|
@@ -277,10 +265,10 @@ function getSidePanelStyle({
|
|
|
277
265
|
})
|
|
278
266
|
};
|
|
279
267
|
}
|
|
268
|
+
|
|
280
269
|
/**
|
|
281
270
|
* Get resize handle style based on a given side
|
|
282
271
|
*/
|
|
283
|
-
|
|
284
272
|
function getResizeHandleStyle(position = 'bottom') {
|
|
285
273
|
const isVertical = isVerticalSide(position);
|
|
286
274
|
const oppositeSide = getOppositeSide(position);
|
|
@@ -290,7 +278,7 @@ function getResizeHandleStyle(position = 'bottom') {
|
|
|
290
278
|
cursor: isVertical ? 'col-resize' : 'row-resize',
|
|
291
279
|
zIndex: 100000,
|
|
292
280
|
[oppositeSide]: 0,
|
|
293
|
-
[marginSide]:
|
|
281
|
+
[marginSide]: `-4px`,
|
|
294
282
|
...(isVertical ? {
|
|
295
283
|
top: 0,
|
|
296
284
|
height: '100%',
|
|
@@ -304,7 +292,7 @@ function getResizeHandleStyle(position = 'bottom') {
|
|
|
304
292
|
|
|
305
293
|
const Panel = styled('div', (_props, theme) => ({
|
|
306
294
|
fontSize: 'clamp(12px, 1.5vw, 14px)',
|
|
307
|
-
fontFamily:
|
|
295
|
+
fontFamily: `sans-serif`,
|
|
308
296
|
display: 'flex',
|
|
309
297
|
backgroundColor: theme.background,
|
|
310
298
|
color: theme.foreground
|
|
@@ -313,10 +301,11 @@ const Panel = styled('div', (_props, theme) => ({
|
|
|
313
301
|
flexDirection: 'column'
|
|
314
302
|
},
|
|
315
303
|
'(max-width: 600px)': {
|
|
316
|
-
fontSize: '.9em'
|
|
317
|
-
|
|
304
|
+
fontSize: '.9em'
|
|
305
|
+
// flexDirection: 'column',
|
|
318
306
|
}
|
|
319
307
|
});
|
|
308
|
+
|
|
320
309
|
const ActiveQueryPanel = styled('div', () => ({
|
|
321
310
|
flex: '1 1 500px',
|
|
322
311
|
display: 'flex',
|
|
@@ -325,7 +314,7 @@ const ActiveQueryPanel = styled('div', () => ({
|
|
|
325
314
|
height: '100%'
|
|
326
315
|
}), {
|
|
327
316
|
'(max-width: 700px)': (_props, theme) => ({
|
|
328
|
-
borderTop:
|
|
317
|
+
borderTop: `2px solid ${theme.gray}`
|
|
329
318
|
})
|
|
330
319
|
});
|
|
331
320
|
const Button = styled('button', (props, theme) => ({
|
|
@@ -363,26 +352,26 @@ const Input = styled('input', (_props, theme) => ({
|
|
|
363
352
|
borderRadius: '.2em',
|
|
364
353
|
color: theme.inputTextColor,
|
|
365
354
|
fontSize: '.9em',
|
|
366
|
-
lineHeight:
|
|
355
|
+
lineHeight: `1.3`,
|
|
367
356
|
padding: '.3em .4em'
|
|
368
357
|
}));
|
|
369
358
|
const Select = styled('select', (_props, theme) => ({
|
|
370
|
-
display:
|
|
371
|
-
fontSize:
|
|
372
|
-
fontFamily:
|
|
359
|
+
display: `inline-block`,
|
|
360
|
+
fontSize: `.9em`,
|
|
361
|
+
fontFamily: `sans-serif`,
|
|
373
362
|
fontWeight: 'normal',
|
|
374
|
-
lineHeight:
|
|
375
|
-
padding:
|
|
363
|
+
lineHeight: `1.3`,
|
|
364
|
+
padding: `.3em 1.5em .3em .5em`,
|
|
376
365
|
height: 'auto',
|
|
377
366
|
border: 0,
|
|
378
|
-
borderRadius:
|
|
379
|
-
appearance:
|
|
367
|
+
borderRadius: `.2em`,
|
|
368
|
+
appearance: `none`,
|
|
380
369
|
WebkitAppearance: 'none',
|
|
381
370
|
backgroundColor: theme.inputBackgroundColor,
|
|
382
|
-
backgroundImage:
|
|
383
|
-
backgroundRepeat:
|
|
384
|
-
backgroundPosition:
|
|
385
|
-
backgroundSize:
|
|
371
|
+
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>")`,
|
|
372
|
+
backgroundRepeat: `no-repeat`,
|
|
373
|
+
backgroundPosition: `right .55em center`,
|
|
374
|
+
backgroundSize: `.65em auto, 100%`,
|
|
386
375
|
color: theme.inputTextColor
|
|
387
376
|
}), {
|
|
388
377
|
'(max-width: 500px)': {
|
|
@@ -475,11 +464,10 @@ const Expander = ({
|
|
|
475
464
|
style: {
|
|
476
465
|
display: 'inline-block',
|
|
477
466
|
transition: 'all .1s ease',
|
|
478
|
-
transform:
|
|
467
|
+
transform: `rotate(${expanded ? 90 : 0}deg) ${style.transform || ''}`,
|
|
479
468
|
...style
|
|
480
469
|
}
|
|
481
470
|
}, "\u25B6");
|
|
482
|
-
|
|
483
471
|
const Copier = () => /*#__PURE__*/React.createElement("span", {
|
|
484
472
|
"aria-label": "Copy object to clipboard",
|
|
485
473
|
title: "Copy object to clipboard",
|
|
@@ -497,7 +485,6 @@ const Copier = () => /*#__PURE__*/React.createElement("span", {
|
|
|
497
485
|
fill: "currentColor",
|
|
498
486
|
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"
|
|
499
487
|
})));
|
|
500
|
-
|
|
501
488
|
const ErrorCopier = () => /*#__PURE__*/React.createElement("span", {
|
|
502
489
|
"aria-label": "Failed copying to clipboard",
|
|
503
490
|
title: "Failed copying to clipboard",
|
|
@@ -523,7 +510,6 @@ const ErrorCopier = () => /*#__PURE__*/React.createElement("span", {
|
|
|
523
510
|
top: '2px'
|
|
524
511
|
}
|
|
525
512
|
}, "See console"));
|
|
526
|
-
|
|
527
513
|
const CopiedCopier = () => /*#__PURE__*/React.createElement("span", {
|
|
528
514
|
"aria-label": "Object copied to clipboard",
|
|
529
515
|
title: "Object copied to clipboard",
|
|
@@ -541,7 +527,6 @@ const CopiedCopier = () => /*#__PURE__*/React.createElement("span", {
|
|
|
541
527
|
fill: "green",
|
|
542
528
|
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"
|
|
543
529
|
})));
|
|
544
|
-
|
|
545
530
|
/**
|
|
546
531
|
* Chunk elements in the array by size
|
|
547
532
|
*
|
|
@@ -555,12 +540,10 @@ function chunkArray(array, size) {
|
|
|
555
540
|
if (size < 1) return [];
|
|
556
541
|
let i = 0;
|
|
557
542
|
const result = [];
|
|
558
|
-
|
|
559
543
|
while (i < array.length) {
|
|
560
544
|
result.push(array.slice(i, i + size));
|
|
561
545
|
i = i + size;
|
|
562
546
|
}
|
|
563
|
-
|
|
564
547
|
return result;
|
|
565
548
|
}
|
|
566
549
|
const DefaultRenderer = ({
|
|
@@ -582,7 +565,7 @@ const DefaultRenderer = ({
|
|
|
582
565
|
onClick: () => toggleExpanded()
|
|
583
566
|
}, /*#__PURE__*/React.createElement(Expander, {
|
|
584
567
|
expanded: expanded
|
|
585
|
-
}), " ", label, ' ', /*#__PURE__*/React.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ?
|
|
568
|
+
}), " ", label, ' ', /*#__PURE__*/React.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ? `items` : `item`)), copyable ? /*#__PURE__*/React.createElement(CopyButton, {
|
|
586
569
|
value: value
|
|
587
570
|
}) : null, expanded ? subEntryPages.length === 1 ? /*#__PURE__*/React.createElement(SubEntries, null, subEntries.map(handleEntry)) : /*#__PURE__*/React.createElement(SubEntries, null, subEntryPages.map((entries, index) => /*#__PURE__*/React.createElement("div", {
|
|
588
571
|
key: index
|
|
@@ -592,11 +575,9 @@ const DefaultRenderer = ({
|
|
|
592
575
|
expanded: expanded
|
|
593
576
|
}), " [", index * pageSize, " ...", ' ', index * pageSize + pageSize - 1, "]"), expandedPages.includes(index) ? /*#__PURE__*/React.createElement(SubEntries, null, entries.map(handleEntry)) : null)))) : null) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Label, null, label, ":"), " ", /*#__PURE__*/React.createElement(Value, null, displayValue(value))));
|
|
594
577
|
};
|
|
595
|
-
|
|
596
578
|
function isIterable(x) {
|
|
597
579
|
return Symbol.iterator in x;
|
|
598
580
|
}
|
|
599
|
-
|
|
600
581
|
function Explorer({
|
|
601
582
|
value,
|
|
602
583
|
defaultExpanded,
|
|
@@ -609,16 +590,15 @@ function Explorer({
|
|
|
609
590
|
const toggleExpanded = React.useCallback(() => setExpanded(old => !old), []);
|
|
610
591
|
let type = typeof value;
|
|
611
592
|
let subEntries = [];
|
|
612
|
-
|
|
613
593
|
const makeProperty = sub => {
|
|
614
594
|
const subDefaultExpanded = defaultExpanded === true ? {
|
|
615
595
|
[sub.label]: true
|
|
616
|
-
} : defaultExpanded
|
|
617
|
-
return {
|
|
596
|
+
} : defaultExpanded?.[sub.label];
|
|
597
|
+
return {
|
|
598
|
+
...sub,
|
|
618
599
|
defaultExpanded: subDefaultExpanded
|
|
619
600
|
};
|
|
620
601
|
};
|
|
621
|
-
|
|
622
602
|
if (Array.isArray(value)) {
|
|
623
603
|
type = 'array';
|
|
624
604
|
subEntries = value.map((d, i) => makeProperty({
|
|
@@ -638,7 +618,6 @@ function Explorer({
|
|
|
638
618
|
value: val
|
|
639
619
|
}));
|
|
640
620
|
}
|
|
641
|
-
|
|
642
621
|
const subEntryPages = chunkArray(subEntries, pageSize);
|
|
643
622
|
return renderer({
|
|
644
623
|
handleEntry: entry => /*#__PURE__*/React.createElement(Explorer, _extends({
|
|
@@ -693,7 +672,7 @@ function ReactQueryDevtools$1({
|
|
|
693
672
|
toggleButtonProps = {},
|
|
694
673
|
position = 'bottom-left',
|
|
695
674
|
containerElement: Container = 'aside',
|
|
696
|
-
|
|
675
|
+
queryClient,
|
|
697
676
|
styleNonce,
|
|
698
677
|
panelPosition: initialPanelPosition = 'bottom'
|
|
699
678
|
}) {
|
|
@@ -706,11 +685,9 @@ function ReactQueryDevtools$1({
|
|
|
706
685
|
const [isResolvedOpen, setIsResolvedOpen] = React.useState(false);
|
|
707
686
|
const [isResizing, setIsResizing] = React.useState(false);
|
|
708
687
|
const isMounted = useIsMounted();
|
|
709
|
-
|
|
710
688
|
const handleDragStart = (panelElement, startEvent) => {
|
|
711
689
|
if (!panelElement) return;
|
|
712
690
|
if (startEvent.button !== 0) return; // Only allow left click for drag
|
|
713
|
-
|
|
714
691
|
const isVertical = isVerticalSide(panelPosition);
|
|
715
692
|
setIsResizing(true);
|
|
716
693
|
const {
|
|
@@ -720,12 +697,12 @@ function ReactQueryDevtools$1({
|
|
|
720
697
|
const startX = startEvent.clientX;
|
|
721
698
|
const startY = startEvent.clientY;
|
|
722
699
|
let newSize = 0;
|
|
723
|
-
|
|
724
700
|
const run = moveEvent => {
|
|
725
701
|
// prevent mouse selecting stuff with mouse drag
|
|
726
|
-
moveEvent.preventDefault();
|
|
727
|
-
// hint: it is different formula for the opposite sides
|
|
702
|
+
moveEvent.preventDefault();
|
|
728
703
|
|
|
704
|
+
// calculate the correct size based on mouse position and current panel position
|
|
705
|
+
// hint: it is different formula for the opposite sides
|
|
729
706
|
if (isVertical) {
|
|
730
707
|
newSize = width + (panelPosition === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX);
|
|
731
708
|
setDevtoolsWidth(newSize);
|
|
@@ -733,48 +710,41 @@ function ReactQueryDevtools$1({
|
|
|
733
710
|
newSize = height + (panelPosition === 'bottom' ? startY - moveEvent.clientY : moveEvent.clientY - startY);
|
|
734
711
|
setDevtoolsHeight(newSize);
|
|
735
712
|
}
|
|
736
|
-
|
|
737
713
|
if (newSize < minPanelSize) {
|
|
738
714
|
setIsOpen(false);
|
|
739
715
|
} else {
|
|
740
716
|
setIsOpen(true);
|
|
741
717
|
}
|
|
742
718
|
};
|
|
743
|
-
|
|
744
719
|
const unsub = () => {
|
|
745
720
|
if (isResizing) {
|
|
746
721
|
setIsResizing(false);
|
|
747
722
|
}
|
|
748
|
-
|
|
749
723
|
document.removeEventListener('mousemove', run, false);
|
|
750
724
|
document.removeEventListener('mouseUp', unsub, false);
|
|
751
725
|
};
|
|
752
|
-
|
|
753
726
|
document.addEventListener('mousemove', run, false);
|
|
754
727
|
document.addEventListener('mouseup', unsub, false);
|
|
755
728
|
};
|
|
756
|
-
|
|
757
729
|
React.useEffect(() => {
|
|
758
|
-
setIsResolvedOpen(isOpen
|
|
759
|
-
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
760
|
-
// Prevents focusing in a closed panel.
|
|
730
|
+
setIsResolvedOpen(isOpen ?? false);
|
|
731
|
+
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
761
732
|
|
|
733
|
+
// Toggle panel visibility before/after transition (depending on direction).
|
|
734
|
+
// Prevents focusing in a closed panel.
|
|
762
735
|
React.useEffect(() => {
|
|
763
736
|
const ref = panelRef.current;
|
|
764
|
-
|
|
765
737
|
if (ref) {
|
|
766
738
|
const handlePanelTransitionStart = () => {
|
|
767
739
|
if (isResolvedOpen) {
|
|
768
740
|
ref.style.visibility = 'visible';
|
|
769
741
|
}
|
|
770
742
|
};
|
|
771
|
-
|
|
772
743
|
const handlePanelTransitionEnd = () => {
|
|
773
744
|
if (!isResolvedOpen) {
|
|
774
745
|
ref.style.visibility = 'hidden';
|
|
775
746
|
}
|
|
776
747
|
};
|
|
777
|
-
|
|
778
748
|
ref.addEventListener('transitionstart', handlePanelTransitionStart);
|
|
779
749
|
ref.addEventListener('transitionend', handlePanelTransitionEnd);
|
|
780
750
|
return () => {
|
|
@@ -782,19 +752,15 @@ function ReactQueryDevtools$1({
|
|
|
782
752
|
ref.removeEventListener('transitionend', handlePanelTransitionEnd);
|
|
783
753
|
};
|
|
784
754
|
}
|
|
785
|
-
|
|
786
755
|
return;
|
|
787
756
|
}, [isResolvedOpen]);
|
|
788
757
|
React.useEffect(() => {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
if (isResolvedOpen && (_rootRef$current = rootRef.current) != null && _rootRef$current.parentElement) {
|
|
758
|
+
if (isResolvedOpen && rootRef.current?.parentElement) {
|
|
792
759
|
const {
|
|
793
760
|
parentElement
|
|
794
761
|
} = rootRef.current;
|
|
795
762
|
const styleProp = getSidedProp('padding', panelPosition);
|
|
796
763
|
const isVertical = isVerticalSide(panelPosition);
|
|
797
|
-
|
|
798
764
|
const previousPaddings = (({
|
|
799
765
|
padding,
|
|
800
766
|
paddingTop,
|
|
@@ -808,20 +774,18 @@ function ReactQueryDevtools$1({
|
|
|
808
774
|
paddingLeft,
|
|
809
775
|
paddingRight
|
|
810
776
|
}))(parentElement.style);
|
|
811
|
-
|
|
812
777
|
const run = () => {
|
|
813
778
|
// reset the padding
|
|
814
779
|
parentElement.style.padding = '0px';
|
|
815
780
|
parentElement.style.paddingTop = '0px';
|
|
816
781
|
parentElement.style.paddingBottom = '0px';
|
|
817
782
|
parentElement.style.paddingLeft = '0px';
|
|
818
|
-
parentElement.style.paddingRight = '0px';
|
|
783
|
+
parentElement.style.paddingRight = '0px';
|
|
784
|
+
// set the new padding based on the new panel position
|
|
819
785
|
|
|
820
|
-
parentElement.style[styleProp] =
|
|
786
|
+
parentElement.style[styleProp] = `${isVertical ? devtoolsWidth : devtoolsHeight}px`;
|
|
821
787
|
};
|
|
822
|
-
|
|
823
788
|
run();
|
|
824
|
-
|
|
825
789
|
if (typeof window !== 'undefined') {
|
|
826
790
|
window.addEventListener('resize', run);
|
|
827
791
|
return () => {
|
|
@@ -832,7 +796,6 @@ function ReactQueryDevtools$1({
|
|
|
832
796
|
};
|
|
833
797
|
}
|
|
834
798
|
}
|
|
835
|
-
|
|
836
799
|
return;
|
|
837
800
|
}, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth]);
|
|
838
801
|
const {
|
|
@@ -843,8 +806,9 @@ function ReactQueryDevtools$1({
|
|
|
843
806
|
style: toggleButtonStyle = {},
|
|
844
807
|
onClick: onToggleClick,
|
|
845
808
|
...otherToggleButtonProps
|
|
846
|
-
} = toggleButtonProps;
|
|
809
|
+
} = toggleButtonProps;
|
|
847
810
|
|
|
811
|
+
// get computed style based on panel position
|
|
848
812
|
const style = getSidePanelStyle({
|
|
849
813
|
position: panelPosition,
|
|
850
814
|
devtoolsTheme: defaultTheme,
|
|
@@ -853,8 +817,9 @@ function ReactQueryDevtools$1({
|
|
|
853
817
|
width: devtoolsWidth,
|
|
854
818
|
isResizing,
|
|
855
819
|
panelStyle
|
|
856
|
-
});
|
|
820
|
+
});
|
|
857
821
|
|
|
822
|
+
// Do not render on the server
|
|
858
823
|
if (!isMounted()) return null;
|
|
859
824
|
return /*#__PURE__*/React.createElement(Container, {
|
|
860
825
|
ref: rootRef,
|
|
@@ -864,7 +829,7 @@ function ReactQueryDevtools$1({
|
|
|
864
829
|
theme: defaultTheme
|
|
865
830
|
}, /*#__PURE__*/React.createElement(ReactQueryDevtoolsPanel$1, _extends({
|
|
866
831
|
ref: panelRef,
|
|
867
|
-
|
|
832
|
+
queryClient: queryClient,
|
|
868
833
|
styleNonce: styleNonce,
|
|
869
834
|
position: panelPosition,
|
|
870
835
|
onPositionChange: setPanelPosition,
|
|
@@ -884,7 +849,7 @@ function ReactQueryDevtools$1({
|
|
|
884
849
|
"aria-expanded": "false",
|
|
885
850
|
onClick: e => {
|
|
886
851
|
setIsOpen(true);
|
|
887
|
-
onToggleClick
|
|
852
|
+
onToggleClick?.(e);
|
|
888
853
|
},
|
|
889
854
|
style: {
|
|
890
855
|
background: 'none',
|
|
@@ -918,22 +883,20 @@ function ReactQueryDevtools$1({
|
|
|
918
883
|
text: "Open React Query Devtools"
|
|
919
884
|
})) : null);
|
|
920
885
|
}
|
|
921
|
-
|
|
922
886
|
const useSubscribeToQueryCache = (queryCache, getSnapshot, skip = false) => {
|
|
923
|
-
return useSyncExternalStore(React.useCallback(onStoreChange => {
|
|
887
|
+
return React.useSyncExternalStore(React.useCallback(onStoreChange => {
|
|
924
888
|
if (!skip) return queryCache.subscribe(notifyManager.batchCalls(onStoreChange));
|
|
925
889
|
return () => {
|
|
926
890
|
return;
|
|
927
891
|
};
|
|
928
892
|
}, [queryCache, skip]), getSnapshot, getSnapshot);
|
|
929
893
|
};
|
|
930
|
-
|
|
931
894
|
const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
|
|
932
895
|
const {
|
|
933
896
|
isOpen = true,
|
|
934
897
|
styleNonce,
|
|
935
898
|
setIsOpen,
|
|
936
|
-
|
|
899
|
+
queryClient,
|
|
937
900
|
onDragStart,
|
|
938
901
|
onPositionChange,
|
|
939
902
|
showCloseButton,
|
|
@@ -945,10 +908,8 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
945
908
|
onClick: onCloseClick,
|
|
946
909
|
...otherCloseButtonProps
|
|
947
910
|
} = closeButtonProps;
|
|
948
|
-
const
|
|
949
|
-
|
|
950
|
-
});
|
|
951
|
-
const queryCache = queryClient.getQueryCache();
|
|
911
|
+
const client = useQueryClient(queryClient);
|
|
912
|
+
const queryCache = client.getQueryCache();
|
|
952
913
|
const [sort, setSort] = useLocalStorage('reactQueryDevtoolsSortFn', Object.keys(sortFns)[0]);
|
|
953
914
|
const [filter, setFilter] = useLocalStorage('reactQueryDevtoolsFilter', '');
|
|
954
915
|
const [baseSort, setBaseSort] = useLocalStorage('reactQueryDevtoolsBaseSort', 1);
|
|
@@ -957,11 +918,9 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
957
918
|
const [activeQueryHash, setActiveQueryHash] = useLocalStorage('reactQueryDevtoolsActiveQueryHash', '');
|
|
958
919
|
const queries = React.useMemo(() => {
|
|
959
920
|
const unsortedQueries = queryCache.getAll();
|
|
960
|
-
|
|
961
921
|
if (queriesCount === 0) {
|
|
962
922
|
return [];
|
|
963
923
|
}
|
|
964
|
-
|
|
965
924
|
const filtered = filter ? unsortedQueries.filter(item => rankItem(item.queryHash, filter).passed) : [...unsortedQueries];
|
|
966
925
|
const sorted = sortFn ? filtered.sort((a, b) => sortFn(a, b) * baseSort) : filtered;
|
|
967
926
|
return sorted;
|
|
@@ -983,7 +942,26 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
983
942
|
}), /*#__PURE__*/React.createElement("style", {
|
|
984
943
|
nonce: styleNonce,
|
|
985
944
|
dangerouslySetInnerHTML: {
|
|
986
|
-
__html:
|
|
945
|
+
__html: `
|
|
946
|
+
.ReactQueryDevtoolsPanel * {
|
|
947
|
+
scrollbar-color: ${defaultTheme.backgroundAlt} ${defaultTheme.gray};
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar, .ReactQueryDevtoolsPanel scrollbar {
|
|
951
|
+
width: 1em;
|
|
952
|
+
height: 1em;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar-track, .ReactQueryDevtoolsPanel scrollbar-track {
|
|
956
|
+
background: ${defaultTheme.backgroundAlt};
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar-thumb, .ReactQueryDevtoolsPanel scrollbar-thumb {
|
|
960
|
+
background: ${defaultTheme.gray};
|
|
961
|
+
border-radius: .5em;
|
|
962
|
+
border: 3px solid ${defaultTheme.backgroundAlt};
|
|
963
|
+
}
|
|
964
|
+
`
|
|
987
965
|
}
|
|
988
966
|
}), /*#__PURE__*/React.createElement("div", {
|
|
989
967
|
style: getResizeHandleStyle(position),
|
|
@@ -994,7 +972,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
994
972
|
minHeight: '40%',
|
|
995
973
|
maxHeight: '100%',
|
|
996
974
|
overflow: 'auto',
|
|
997
|
-
borderRight:
|
|
975
|
+
borderRight: `1px solid ${defaultTheme.grayAlt}`,
|
|
998
976
|
display: 'flex',
|
|
999
977
|
flexDirection: 'column'
|
|
1000
978
|
}
|
|
@@ -1062,7 +1040,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1062
1040
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
1063
1041
|
placeholder: "Filter",
|
|
1064
1042
|
"aria-label": "Filter by queryhash",
|
|
1065
|
-
value: filter
|
|
1043
|
+
value: filter ?? '',
|
|
1066
1044
|
onChange: e => setFilter(e.target.value),
|
|
1067
1045
|
onKeyDown: e => {
|
|
1068
1046
|
if (e.key === 'Escape') setFilter('');
|
|
@@ -1072,7 +1050,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1072
1050
|
marginRight: '.5em',
|
|
1073
1051
|
width: '100%'
|
|
1074
1052
|
}
|
|
1075
|
-
}),
|
|
1053
|
+
}), /*#__PURE__*/React.createElement(Select, {
|
|
1076
1054
|
"aria-label": "Sort queries",
|
|
1077
1055
|
value: sort,
|
|
1078
1056
|
onChange: e => setSort(e.target.value),
|
|
@@ -1153,7 +1131,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1153
1131
|
d: "M3.515 9.515c4.686 -4.687 12.284 -4.687 17 0"
|
|
1154
1132
|
}))), /*#__PURE__*/React.createElement(ScreenReader, {
|
|
1155
1133
|
text: isMockOffline ? 'Restore offline mock' : 'Mock offline behavior'
|
|
1156
|
-
})))
|
|
1134
|
+
}))))), /*#__PURE__*/React.createElement("div", {
|
|
1157
1135
|
style: {
|
|
1158
1136
|
overflowY: 'auto',
|
|
1159
1137
|
flex: '1'
|
|
@@ -1169,7 +1147,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1169
1147
|
}))), activeQueryHash && isOpen ? /*#__PURE__*/React.createElement(ActiveQuery, {
|
|
1170
1148
|
activeQueryHash: activeQueryHash,
|
|
1171
1149
|
queryCache: queryCache,
|
|
1172
|
-
queryClient:
|
|
1150
|
+
queryClient: client
|
|
1173
1151
|
}) : null, showCloseButton ? /*#__PURE__*/React.createElement(Button, _extends({
|
|
1174
1152
|
type: "button",
|
|
1175
1153
|
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
@@ -1186,44 +1164,26 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1186
1164
|
},
|
|
1187
1165
|
onClick: e => {
|
|
1188
1166
|
setIsOpen(false);
|
|
1189
|
-
onCloseClick
|
|
1167
|
+
onCloseClick?.(e);
|
|
1190
1168
|
}
|
|
1191
1169
|
}), "Close") : null));
|
|
1192
1170
|
});
|
|
1193
|
-
|
|
1194
1171
|
const ActiveQuery = ({
|
|
1195
1172
|
queryCache,
|
|
1196
1173
|
activeQueryHash,
|
|
1197
1174
|
queryClient
|
|
1198
1175
|
}) => {
|
|
1199
|
-
var _useSubscribeToQueryC, _useSubscribeToQueryC2;
|
|
1200
|
-
|
|
1201
1176
|
const activeQuery = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash));
|
|
1202
|
-
const activeQueryState = useSubscribeToQueryCache(queryCache, () =>
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
return (_queryCache$getAll$fi = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi.state;
|
|
1206
|
-
});
|
|
1207
|
-
const isStale = (_useSubscribeToQueryC = useSubscribeToQueryCache(queryCache, () => {
|
|
1208
|
-
var _queryCache$getAll$fi2;
|
|
1209
|
-
|
|
1210
|
-
return (_queryCache$getAll$fi2 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi2.isStale();
|
|
1211
|
-
})) != null ? _useSubscribeToQueryC : false;
|
|
1212
|
-
const observerCount = (_useSubscribeToQueryC2 = useSubscribeToQueryCache(queryCache, () => {
|
|
1213
|
-
var _queryCache$getAll$fi3;
|
|
1214
|
-
|
|
1215
|
-
return (_queryCache$getAll$fi3 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi3.getObserversCount();
|
|
1216
|
-
})) != null ? _useSubscribeToQueryC2 : 0;
|
|
1217
|
-
|
|
1177
|
+
const activeQueryState = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.state);
|
|
1178
|
+
const isStale = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.isStale()) ?? false;
|
|
1179
|
+
const observerCount = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.getObserversCount()) ?? 0;
|
|
1218
1180
|
const handleRefetch = () => {
|
|
1219
|
-
const promise = activeQuery
|
|
1220
|
-
promise
|
|
1181
|
+
const promise = activeQuery?.fetch();
|
|
1182
|
+
promise?.catch(noop);
|
|
1221
1183
|
};
|
|
1222
|
-
|
|
1223
1184
|
if (!activeQuery || !activeQueryState) {
|
|
1224
1185
|
return null;
|
|
1225
1186
|
}
|
|
1226
|
-
|
|
1227
1187
|
return /*#__PURE__*/React.createElement(ActiveQueryPanel, null, /*#__PURE__*/React.createElement("div", {
|
|
1228
1188
|
style: {
|
|
1229
1189
|
padding: '.5em',
|
|
@@ -1355,7 +1315,6 @@ const ActiveQuery = ({
|
|
|
1355
1315
|
}
|
|
1356
1316
|
})));
|
|
1357
1317
|
};
|
|
1358
|
-
|
|
1359
1318
|
const QueryStatusCount = ({
|
|
1360
1319
|
queryCache
|
|
1361
1320
|
}) => {
|
|
@@ -1393,52 +1352,37 @@ const QueryStatusCount = ({
|
|
|
1393
1352
|
}
|
|
1394
1353
|
}, "inactive ", /*#__PURE__*/React.createElement(Code, null, "(", hasInactive, ")")));
|
|
1395
1354
|
};
|
|
1396
|
-
|
|
1397
1355
|
const QueryRow = /*#__PURE__*/React.memo(({
|
|
1398
1356
|
queryKey,
|
|
1399
1357
|
setActiveQueryHash,
|
|
1400
1358
|
activeQueryHash,
|
|
1401
1359
|
queryCache
|
|
1402
1360
|
}) => {
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
});
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
return (_queryCache$find3 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find3.isStale();
|
|
1419
|
-
})) != null ? _useSubscribeToQueryC4 : false;
|
|
1420
|
-
const isDisabled = (_useSubscribeToQueryC5 = useSubscribeToQueryCache(queryCache, () => {
|
|
1421
|
-
var _queryCache$find4;
|
|
1422
|
-
|
|
1423
|
-
return (_queryCache$find4 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find4.isDisabled();
|
|
1424
|
-
})) != null ? _useSubscribeToQueryC5 : false;
|
|
1425
|
-
const observerCount = (_useSubscribeToQueryC6 = useSubscribeToQueryCache(queryCache, () => {
|
|
1426
|
-
var _queryCache$find5;
|
|
1427
|
-
|
|
1428
|
-
return (_queryCache$find5 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find5.getObserversCount();
|
|
1429
|
-
})) != null ? _useSubscribeToQueryC6 : 0;
|
|
1430
|
-
|
|
1361
|
+
const queryHash = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1362
|
+
queryKey
|
|
1363
|
+
})?.queryHash) ?? '';
|
|
1364
|
+
const queryState = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1365
|
+
queryKey
|
|
1366
|
+
})?.state);
|
|
1367
|
+
const isStale = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1368
|
+
queryKey
|
|
1369
|
+
})?.isStale()) ?? false;
|
|
1370
|
+
const isDisabled = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1371
|
+
queryKey
|
|
1372
|
+
})?.isDisabled()) ?? false;
|
|
1373
|
+
const observerCount = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1374
|
+
queryKey
|
|
1375
|
+
})?.getObserversCount()) ?? 0;
|
|
1431
1376
|
if (!queryState) {
|
|
1432
1377
|
return null;
|
|
1433
1378
|
}
|
|
1434
|
-
|
|
1435
1379
|
return /*#__PURE__*/React.createElement("div", {
|
|
1436
1380
|
role: "button",
|
|
1437
|
-
"aria-label":
|
|
1381
|
+
"aria-label": `Open query details for ${queryHash}`,
|
|
1438
1382
|
onClick: () => setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash),
|
|
1439
1383
|
style: {
|
|
1440
1384
|
display: 'flex',
|
|
1441
|
-
borderBottom:
|
|
1385
|
+
borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
|
|
1442
1386
|
cursor: 'pointer',
|
|
1443
1387
|
background: queryHash === activeQueryHash ? 'rgba(255,255,255,.1)' : undefined
|
|
1444
1388
|
}
|
|
@@ -1474,9 +1418,10 @@ const QueryRow = /*#__PURE__*/React.memo(({
|
|
|
1474
1418
|
style: {
|
|
1475
1419
|
padding: '.5em'
|
|
1476
1420
|
}
|
|
1477
|
-
},
|
|
1478
|
-
});
|
|
1421
|
+
}, `${queryHash}`));
|
|
1422
|
+
});
|
|
1479
1423
|
|
|
1424
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1480
1425
|
function noop() {}
|
|
1481
1426
|
|
|
1482
1427
|
const ReactQueryDevtools = ReactQueryDevtools$1;
|