@tanstack/react-query-devtools 5.0.0-alpha.11 → 5.0.0-alpha.14
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/CachePanel/ActiveQuery.d.ts +18 -0
- package/build/lib/CachePanel/ActiveQuery.esm.js +271 -0
- package/build/lib/CachePanel/ActiveQuery.esm.js.map +1 -0
- package/build/lib/CachePanel/ActiveQuery.js +275 -0
- package/build/lib/CachePanel/ActiveQuery.js.map +1 -0
- package/build/lib/CachePanel/ActiveQuery.mjs +257 -0
- package/build/lib/CachePanel/ActiveQuery.mjs.map +1 -0
- package/build/lib/CachePanel/CachePanel.d.ts +57 -0
- package/build/lib/CachePanel/CachePanel.esm.js +301 -0
- package/build/lib/CachePanel/CachePanel.esm.js.map +1 -0
- package/build/lib/CachePanel/CachePanel.js +306 -0
- package/build/lib/CachePanel/CachePanel.js.map +1 -0
- package/build/lib/CachePanel/CachePanel.mjs +301 -0
- package/build/lib/CachePanel/CachePanel.mjs.map +1 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.d.ts +7 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.esm.js +49 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.esm.js.map +1 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.js +53 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.js.map +1 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.mjs +49 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.mjs.map +1 -0
- package/build/lib/CachePanel/QueryRow.d.ts +13 -0
- package/build/lib/CachePanel/QueryRow.esm.js +98 -0
- package/build/lib/CachePanel/QueryRow.esm.js.map +1 -0
- package/build/lib/CachePanel/QueryRow.js +102 -0
- package/build/lib/CachePanel/QueryRow.js.map +1 -0
- package/build/lib/CachePanel/QueryRow.mjs +82 -0
- package/build/lib/CachePanel/QueryRow.mjs.map +1 -0
- package/build/lib/devtools.d.ts +3 -64
- package/build/lib/devtools.esm.js +2 -669
- package/build/lib/devtools.esm.js.map +1 -1
- package/build/lib/devtools.js +3 -669
- package/build/lib/devtools.js.map +1 -1
- package/build/lib/devtools.mjs +2 -639
- package/build/lib/devtools.mjs.map +1 -1
- package/build/lib/index.esm.js +2 -1
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +2 -1
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +2 -1
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/index.prod.esm.js +745 -713
- package/build/lib/index.prod.esm.js.map +1 -1
- package/build/lib/index.prod.js +742 -710
- package/build/lib/index.prod.js.map +1 -1
- package/build/lib/index.prod.mjs +745 -713
- package/build/lib/index.prod.mjs.map +1 -1
- package/build/lib/styledComponents.esm.js +8 -0
- package/build/lib/styledComponents.esm.js.map +1 -1
- package/build/lib/styledComponents.js +8 -0
- package/build/lib/styledComponents.js.map +1 -1
- package/build/lib/styledComponents.mjs +8 -0
- package/build/lib/styledComponents.mjs.map +1 -1
- package/build/lib/types.d.ts +11 -0
- package/build/lib/useSubscribeToQueryCache.d.ts +3 -0
- package/build/lib/useSubscribeToQueryCache.esm.js +15 -0
- package/build/lib/useSubscribeToQueryCache.esm.js.map +1 -0
- package/build/lib/useSubscribeToQueryCache.js +19 -0
- package/build/lib/useSubscribeToQueryCache.js.map +1 -0
- package/build/lib/useSubscribeToQueryCache.mjs +15 -0
- package/build/lib/useSubscribeToQueryCache.mjs.map +1 -0
- package/build/umd/index.development.js +2385 -2353
- package/build/umd/index.development.js.map +1 -1
- package/package.json +3 -3
- package/src/CachePanel/ActiveQuery.tsx +380 -0
- package/src/CachePanel/CachePanel.tsx +427 -0
- package/src/CachePanel/Header/QueryStatusCount.tsx +93 -0
- package/src/CachePanel/QueryRow.tsx +125 -0
- package/src/devtools.tsx +5 -1008
- package/src/styledComponents.ts +16 -0
- package/src/types.ts +12 -0
- package/src/useSubscribeToQueryCache.ts +26 -0
package/build/lib/index.prod.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
+
var SuperJSON = require('superjson');
|
|
4
5
|
var reactQuery = require('@tanstack/react-query');
|
|
5
6
|
var matchSorterUtils = require('@tanstack/match-sorter-utils');
|
|
6
|
-
var SuperJSON = require('superjson');
|
|
7
7
|
|
|
8
8
|
function _interopNamespaceDefault(e) {
|
|
9
9
|
var n = Object.create(null);
|
|
@@ -311,6 +311,46 @@ function getResizeHandleStyle(position = 'bottom') {
|
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
function ScreenReader({
|
|
315
|
+
text
|
|
316
|
+
}) {
|
|
317
|
+
return /*#__PURE__*/React__namespace.createElement("span", {
|
|
318
|
+
style: {
|
|
319
|
+
position: 'absolute',
|
|
320
|
+
width: '0.1px',
|
|
321
|
+
height: '0.1px',
|
|
322
|
+
overflow: 'hidden'
|
|
323
|
+
}
|
|
324
|
+
}, text);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function Logo(props) {
|
|
328
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
329
|
+
width: "40px",
|
|
330
|
+
height: "40px",
|
|
331
|
+
viewBox: "0 0 190 190",
|
|
332
|
+
version: "1.1"
|
|
333
|
+
}, props), /*#__PURE__*/React__namespace.createElement("g", {
|
|
334
|
+
stroke: "none",
|
|
335
|
+
strokeWidth: "1",
|
|
336
|
+
fill: "none",
|
|
337
|
+
fillRule: "evenodd"
|
|
338
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
339
|
+
transform: "translate(-33.000000, 0.000000)"
|
|
340
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
341
|
+
d: "M72.7239712,61.3436237 C69.631224,46.362877 68.9675112,34.8727722 70.9666331,26.5293551 C72.1555965,21.5671678 74.3293088,17.5190846 77.6346064,14.5984631 C81.1241394,11.5150478 85.5360327,10.0020122 90.493257,10.0020122 C98.6712013,10.0020122 107.26826,13.7273214 116.455725,20.8044264 C120.20312,23.6910458 124.092437,27.170411 128.131651,31.2444746 C128.45314,30.8310265 128.816542,30.4410453 129.22143,30.0806152 C140.64098,19.9149716 150.255245,13.5989272 158.478408,11.1636507 C163.367899,9.715636 167.958526,9.57768202 172.138936,10.983031 C176.551631,12.4664684 180.06766,15.5329489 182.548314,19.8281091 C186.642288,26.9166735 187.721918,36.2310983 186.195595,47.7320243 C185.573451,52.4199112 184.50985,57.5263831 183.007094,63.0593153 C183.574045,63.1277086 184.142416,63.2532808 184.705041,63.4395297 C199.193932,68.2358678 209.453582,73.3937462 215.665021,79.2882839 C219.360669,82.7953831 221.773972,86.6998434 222.646365,91.0218204 C223.567176,95.5836746 222.669313,100.159332 220.191548,104.451297 C216.105211,111.529614 208.591643,117.11221 197.887587,121.534031 C193.589552,123.309539 188.726579,124.917559 183.293259,126.363748 C183.541176,126.92292 183.733521,127.516759 183.862138,128.139758 C186.954886,143.120505 187.618598,154.61061 185.619477,162.954027 C184.430513,167.916214 182.256801,171.964297 178.951503,174.884919 C175.46197,177.968334 171.050077,179.48137 166.092853,179.48137 C157.914908,179.48137 149.31785,175.756061 140.130385,168.678956 C136.343104,165.761613 132.410866,162.238839 128.325434,158.108619 C127.905075,158.765474 127.388968,159.376011 126.77857,159.919385 C115.35902,170.085028 105.744755,176.401073 97.5215915,178.836349 C92.6321009,180.284364 88.0414736,180.422318 83.8610636,179.016969 C79.4483686,177.533532 75.9323404,174.467051 73.4516862,170.171891 C69.3577116,163.083327 68.2780823,153.768902 69.8044053,142.267976 C70.449038,137.410634 71.56762,132.103898 73.1575891,126.339009 C72.5361041,126.276104 71.9120754,126.144816 71.2949591,125.940529 C56.8060684,121.144191 46.5464184,115.986312 40.3349789,110.091775 C36.6393312,106.584675 34.2260275,102.680215 33.3536352,98.3582381 C32.4328237,93.7963839 33.3306866,89.2207269 35.8084524,84.9287618 C39.8947886,77.8504443 47.4083565,72.2678481 58.1124133,67.8460273 C62.5385143,66.0176154 67.5637208,64.366822 73.1939394,62.8874674 C72.9933393,62.3969171 72.8349374,61.8811235 72.7239712,61.3436237 Z",
|
|
342
|
+
fill: "#002C4B",
|
|
343
|
+
fillRule: "nonzero",
|
|
344
|
+
transform: "translate(128.000000, 95.000000) scale(-1, 1) translate(-128.000000, -95.000000) "
|
|
345
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
346
|
+
d: "M113.396882,64 L142.608177,64 C144.399254,64 146.053521,64.958025 146.944933,66.5115174 L161.577138,92.0115174 C162.461464,93.5526583 162.461464,95.4473417 161.577138,96.9884826 L146.944933,122.488483 C146.053521,124.041975 144.399254,125 142.608177,125 L113.396882,125 C111.605806,125 109.951539,124.041975 109.060126,122.488483 L94.4279211,96.9884826 C93.543596,95.4473417 93.543596,93.5526583 94.4279211,92.0115174 L109.060126,66.5115174 C109.951539,64.958025 111.605806,64 113.396882,64 Z M138.987827,70.2765273 C140.779849,70.2765273 142.434839,71.2355558 143.325899,72.7903404 L154.343038,92.0138131 C155.225607,93.5537825 155.225607,95.4462175 154.343038,96.9861869 L143.325899,116.20966 C142.434839,117.764444 140.779849,118.723473 138.987827,118.723473 L117.017233,118.723473 C115.225211,118.723473 113.570221,117.764444 112.67916,116.20966 L101.662022,96.9861869 C100.779452,95.4462175 100.779452,93.5537825 101.662022,92.0138131 L112.67916,72.7903404 C113.570221,71.2355558 115.225211,70.2765273 117.017233,70.2765273 L138.987827,70.2765273 Z M135.080648,77.1414791 L120.924411,77.1414791 C119.134228,77.1414791 117.480644,78.0985567 116.5889,79.6508285 L116.5889,79.6508285 L109.489217,92.0093494 C108.603232,93.5515958 108.603232,95.4484042 109.489217,96.9906506 L109.489217,96.9906506 L116.5889,109.349172 C117.480644,110.901443 119.134228,111.858521 120.924411,111.858521 L120.924411,111.858521 L135.080648,111.858521 C136.870831,111.858521 138.524416,110.901443 139.41616,109.349172 L139.41616,109.349172 L146.515843,96.9906506 C147.401828,95.4484042 147.401828,93.5515958 146.515843,92.0093494 L146.515843,92.0093494 L139.41616,79.6508285 C138.524416,78.0985567 136.870831,77.1414791 135.080648,77.1414791 L135.080648,77.1414791 Z M131.319186,83.7122186 C133.108028,83.7122186 134.760587,84.6678753 135.652827,86.2183156 L138.983552,92.0060969 C139.87203,93.5500005 139.87203,95.4499995 138.983552,96.9939031 L135.652827,102.781684 C134.760587,104.332125 133.108028,105.287781 131.319186,105.287781 L124.685874,105.287781 C122.897032,105.287781 121.244473,104.332125 120.352233,102.781684 L117.021508,96.9939031 C116.13303,95.4499995 116.13303,93.5500005 117.021508,92.0060969 L120.352233,86.2183156 C121.244473,84.6678753 122.897032,83.7122186 124.685874,83.7122186 L131.319186,83.7122186 Z M128.003794,90.1848875 C126.459294,90.1848875 125.034382,91.0072828 124.263005,92.3424437 C123.491732,93.6774232 123.491732,95.3225768 124.263005,96.6575563 C125.034382,97.9927172 126.459294,98.8151125 128.001266,98.8151125 L128.001266,98.8151125 C129.545766,98.8151125 130.970678,97.9927172 131.742055,96.6575563 C132.513327,95.3225768 132.513327,93.6774232 131.742055,92.3424437 C130.970678,91.0072828 129.545766,90.1848875 128.003794,90.1848875 L128.003794,90.1848875 Z M93,94.5009646 L100.767764,94.5009646",
|
|
347
|
+
fill: "#FFD94C"
|
|
348
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
349
|
+
d: "M87.8601729,108.357758 C89.1715224,107.608286 90.8360246,108.074601 91.5779424,109.399303 L91.5779424,109.399303 L92.0525843,110.24352 C95.8563392,116.982993 99.8190116,123.380176 103.940602,129.435068 C108.807881,136.585427 114.28184,143.82411 120.362479,151.151115 C121.316878,152.30114 121.184944,154.011176 120.065686,154.997937 L120.065686,154.997937 L119.454208,155.534625 C99.3465389,173.103314 86.2778188,176.612552 80.2480482,166.062341 C74.3500652,155.742717 76.4844915,136.982888 86.6513274,109.782853 C86.876818,109.179582 87.3045861,108.675291 87.8601729,108.357758 Z M173.534177,129.041504 C174.986131,128.785177 176.375496,129.742138 176.65963,131.194242 L176.65963,131.194242 L176.812815,131.986376 C181.782365,157.995459 178.283348,171 166.315764,171 C154.609745,171 139.708724,159.909007 121.612702,137.727022 C121.211349,137.235047 120.994572,136.617371 121,135.981509 C121.013158,134.480686 122.235785,133.274651 123.730918,133.287756 L123.730918,133.287756 L124.684654,133.294531 C132.305698,133.335994 139.714387,133.071591 146.910723,132.501323 C155.409039,131.82788 164.283523,130.674607 173.534177,129.041504 Z M180.408726,73.8119663 C180.932139,72.4026903 182.508386,71.6634537 183.954581,72.149012 L183.954581,72.149012 L184.742552,72.4154854 C210.583763,81.217922 220.402356,90.8916805 214.198332,101.436761 C208.129904,111.751366 190.484347,119.260339 161.26166,123.963678 C160.613529,124.067994 159.948643,123.945969 159.382735,123.618843 C158.047025,122.846729 157.602046,121.158214 158.388848,119.847438 L158.388848,119.847438 L158.889328,119.0105 C162.877183,112.31633 166.481358,105.654262 169.701854,99.0242957 C173.50501,91.1948179 177.073967,82.7907081 180.408726,73.8119663 Z M94.7383398,66.0363218 C95.3864708,65.9320063 96.0513565,66.0540315 96.6172646,66.3811573 C97.9529754,67.153271 98.3979538,68.8417862 97.6111517,70.1525615 L97.6111517,70.1525615 L97.1106718,70.9895001 C93.1228168,77.6836699 89.5186416,84.3457379 86.2981462,90.9757043 C82.49499,98.8051821 78.9260328,107.209292 75.5912744,116.188034 C75.0678608,117.59731 73.4916142,118.336546 72.045419,117.850988 L72.045419,117.850988 L71.2574475,117.584515 C45.4162372,108.782078 35.597644,99.1083195 41.8016679,88.5632391 C47.8700957,78.2486335 65.515653,70.7396611 94.7383398,66.0363218 Z M136.545792,34.4653746 C156.653461,16.8966864 169.722181,13.3874478 175.751952,23.9376587 C181.649935,34.2572826 179.515508,53.0171122 169.348673,80.2171474 C169.123182,80.8204179 168.695414,81.324709 168.139827,81.6422422 C166.828478,82.3917144 165.163975,81.9253986 164.422058,80.6006966 L164.422058,80.6006966 L163.947416,79.7564798 C160.143661,73.0170065 156.180988,66.6198239 152.059398,60.564932 C147.192119,53.4145727 141.71816,46.1758903 135.637521,38.8488847 C134.683122,37.6988602 134.815056,35.9888243 135.934314,35.0020629 L135.934314,35.0020629 Z M90.6842361,18 C102.390255,18 117.291276,29.0909926 135.387298,51.2729777 C135.788651,51.7649527 136.005428,52.3826288 136,53.0184911 C135.986842,54.5193144 134.764215,55.7253489 133.269082,55.7122445 L133.269082,55.7122445 L132.315346,55.7054689 C124.694302,55.6640063 117.285613,55.9284091 110.089277,56.4986773 C101.590961,57.17212 92.7164767,58.325393 83.4658235,59.9584962 C82.0138691,60.2148231 80.6245044,59.2578618 80.3403697,57.805758 L80.3403697,57.805758 L80.1871846,57.0136235 C75.2176347,31.0045412 78.7166519,18 90.6842361,18 Z",
|
|
350
|
+
fill: "#FF4154"
|
|
351
|
+
}))));
|
|
352
|
+
}
|
|
353
|
+
|
|
314
354
|
const Panel = styled('div', (_props, theme) => ({
|
|
315
355
|
fontSize: 'clamp(12px, 1.5vw, 14px)',
|
|
316
356
|
fontFamily: `sans-serif`,
|
|
@@ -327,6 +367,7 @@ const Panel = styled('div', (_props, theme) => ({
|
|
|
327
367
|
}
|
|
328
368
|
});
|
|
329
369
|
|
|
370
|
+
Panel.displayName = 'Panel';
|
|
330
371
|
const ActiveQueryPanel = styled('div', () => ({
|
|
331
372
|
flex: '1 1 500px',
|
|
332
373
|
display: 'flex',
|
|
@@ -338,6 +379,7 @@ const ActiveQueryPanel = styled('div', () => ({
|
|
|
338
379
|
borderTop: `2px solid ${theme.gray}`
|
|
339
380
|
})
|
|
340
381
|
});
|
|
382
|
+
ActiveQueryPanel.displayName = 'ActiveQueryPanel';
|
|
341
383
|
const Button = styled('button', (props, theme) => ({
|
|
342
384
|
appearance: 'none',
|
|
343
385
|
fontSize: '.9em',
|
|
@@ -350,12 +392,14 @@ const Button = styled('button', (props, theme) => ({
|
|
|
350
392
|
opacity: props.disabled ? '.5' : undefined,
|
|
351
393
|
cursor: 'pointer'
|
|
352
394
|
}));
|
|
395
|
+
Button.displayName = 'Button';
|
|
353
396
|
const QueryKeys = styled('span', {
|
|
354
397
|
display: 'flex',
|
|
355
398
|
flexWrap: 'wrap',
|
|
356
399
|
gap: '0.5em',
|
|
357
400
|
fontSize: '0.9em'
|
|
358
401
|
});
|
|
402
|
+
QueryKeys.displayName = 'QueryKeys';
|
|
359
403
|
const QueryKey = styled('span', {
|
|
360
404
|
display: 'inline-flex',
|
|
361
405
|
alignItems: 'center',
|
|
@@ -364,11 +408,13 @@ const QueryKey = styled('span', {
|
|
|
364
408
|
textShadow: '0 0 10px black',
|
|
365
409
|
borderRadius: '.2em'
|
|
366
410
|
});
|
|
411
|
+
QueryKey.displayName = 'QueryKey';
|
|
367
412
|
const Code = styled('code', {
|
|
368
413
|
fontSize: '.9em',
|
|
369
414
|
color: 'inherit',
|
|
370
415
|
background: 'inherit'
|
|
371
416
|
});
|
|
417
|
+
Code.displayName = 'Code';
|
|
372
418
|
const Input = styled('input', (_props, theme) => ({
|
|
373
419
|
backgroundColor: theme.inputBackgroundColor,
|
|
374
420
|
border: 0,
|
|
@@ -378,6 +424,7 @@ const Input = styled('input', (_props, theme) => ({
|
|
|
378
424
|
lineHeight: `1.3`,
|
|
379
425
|
padding: '.3em .4em'
|
|
380
426
|
}));
|
|
427
|
+
Input.displayName = 'Input';
|
|
381
428
|
const Select = styled('select', (_props, theme) => ({
|
|
382
429
|
display: `inline-block`,
|
|
383
430
|
fontSize: `.9em`,
|
|
@@ -401,20 +448,149 @@ const Select = styled('select', (_props, theme) => ({
|
|
|
401
448
|
display: 'none'
|
|
402
449
|
}
|
|
403
450
|
});
|
|
451
|
+
Select.displayName = 'Select';
|
|
404
452
|
|
|
405
|
-
|
|
406
|
-
|
|
453
|
+
const useSubscribeToQueryCache = (queryCache, getSnapshot, skip = false) => {
|
|
454
|
+
return React.useSyncExternalStore(React.useCallback(onStoreChange => {
|
|
455
|
+
if (!skip) return queryCache.subscribe(reactQuery.notifyManager.batchCalls(onStoreChange));
|
|
456
|
+
return () => {
|
|
457
|
+
return;
|
|
458
|
+
};
|
|
459
|
+
}, [queryCache, skip]), getSnapshot, getSnapshot);
|
|
460
|
+
};
|
|
461
|
+
var useSubscribeToQueryCache$1 = useSubscribeToQueryCache;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Displays the number of queries for each status
|
|
465
|
+
*/
|
|
466
|
+
function QueryStatusCount({
|
|
467
|
+
queryCache
|
|
407
468
|
}) {
|
|
408
|
-
|
|
469
|
+
const hasFresh = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fresh').length);
|
|
470
|
+
const hasFetching = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fetching').length);
|
|
471
|
+
const hasPaused = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'paused').length);
|
|
472
|
+
const hasStale = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'stale').length);
|
|
473
|
+
const hasInactive = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'inactive').length);
|
|
474
|
+
return /*#__PURE__*/React.createElement(QueryKeys, null, /*#__PURE__*/React.createElement(QueryKey, {
|
|
409
475
|
style: {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
height: '0.1px',
|
|
413
|
-
overflow: 'hidden'
|
|
476
|
+
background: defaultTheme.success,
|
|
477
|
+
opacity: hasFresh ? 1 : 0.3
|
|
414
478
|
}
|
|
415
|
-
},
|
|
479
|
+
}, "fresh ", /*#__PURE__*/React.createElement(Code, null, "(", hasFresh, ")")), ' ', /*#__PURE__*/React.createElement(QueryKey, {
|
|
480
|
+
style: {
|
|
481
|
+
background: defaultTheme.active,
|
|
482
|
+
opacity: hasFetching ? 1 : 0.3
|
|
483
|
+
}
|
|
484
|
+
}, "fetching ", /*#__PURE__*/React.createElement(Code, null, "(", hasFetching, ")")), ' ', /*#__PURE__*/React.createElement(QueryKey, {
|
|
485
|
+
style: {
|
|
486
|
+
background: defaultTheme.paused,
|
|
487
|
+
opacity: hasPaused ? 1 : 0.3
|
|
488
|
+
}
|
|
489
|
+
}, "paused ", /*#__PURE__*/React.createElement(Code, null, "(", hasPaused, ")")), ' ', /*#__PURE__*/React.createElement(QueryKey, {
|
|
490
|
+
style: {
|
|
491
|
+
background: defaultTheme.warning,
|
|
492
|
+
color: 'black',
|
|
493
|
+
textShadow: '0',
|
|
494
|
+
opacity: hasStale ? 1 : 0.3
|
|
495
|
+
}
|
|
496
|
+
}, "stale ", /*#__PURE__*/React.createElement(Code, null, "(", hasStale, ")")), ' ', /*#__PURE__*/React.createElement(QueryKey, {
|
|
497
|
+
style: {
|
|
498
|
+
background: defaultTheme.gray,
|
|
499
|
+
opacity: hasInactive ? 1 : 0.3
|
|
500
|
+
}
|
|
501
|
+
}, "inactive ", /*#__PURE__*/React.createElement(Code, null, "(", hasInactive, ")")));
|
|
416
502
|
}
|
|
417
503
|
|
|
504
|
+
/**
|
|
505
|
+
* Row for a query in the query list
|
|
506
|
+
*/
|
|
507
|
+
const QueryRow = /*#__PURE__*/React.memo(({
|
|
508
|
+
queryKey,
|
|
509
|
+
setActiveQueryHash,
|
|
510
|
+
activeQueryHash,
|
|
511
|
+
queryCache
|
|
512
|
+
}) => {
|
|
513
|
+
var _useSubscribeToQueryC, _useSubscribeToQueryC2, _useSubscribeToQueryC3, _useSubscribeToQueryC4;
|
|
514
|
+
const queryHash = (_useSubscribeToQueryC = useSubscribeToQueryCache$1(queryCache, () => {
|
|
515
|
+
var _queryCache$find;
|
|
516
|
+
return (_queryCache$find = queryCache.find({
|
|
517
|
+
queryKey
|
|
518
|
+
})) == null ? void 0 : _queryCache$find.queryHash;
|
|
519
|
+
})) != null ? _useSubscribeToQueryC : '';
|
|
520
|
+
const queryState = useSubscribeToQueryCache$1(queryCache, () => {
|
|
521
|
+
var _queryCache$find2;
|
|
522
|
+
return (_queryCache$find2 = queryCache.find({
|
|
523
|
+
queryKey
|
|
524
|
+
})) == null ? void 0 : _queryCache$find2.state;
|
|
525
|
+
});
|
|
526
|
+
const isStale = (_useSubscribeToQueryC2 = useSubscribeToQueryCache$1(queryCache, () => {
|
|
527
|
+
var _queryCache$find3;
|
|
528
|
+
return (_queryCache$find3 = queryCache.find({
|
|
529
|
+
queryKey
|
|
530
|
+
})) == null ? void 0 : _queryCache$find3.isStale();
|
|
531
|
+
})) != null ? _useSubscribeToQueryC2 : false;
|
|
532
|
+
const isDisabled = (_useSubscribeToQueryC3 = useSubscribeToQueryCache$1(queryCache, () => {
|
|
533
|
+
var _queryCache$find4;
|
|
534
|
+
return (_queryCache$find4 = queryCache.find({
|
|
535
|
+
queryKey
|
|
536
|
+
})) == null ? void 0 : _queryCache$find4.isDisabled();
|
|
537
|
+
})) != null ? _useSubscribeToQueryC3 : false;
|
|
538
|
+
const observerCount = (_useSubscribeToQueryC4 = useSubscribeToQueryCache$1(queryCache, () => {
|
|
539
|
+
var _queryCache$find5;
|
|
540
|
+
return (_queryCache$find5 = queryCache.find({
|
|
541
|
+
queryKey
|
|
542
|
+
})) == null ? void 0 : _queryCache$find5.getObserversCount();
|
|
543
|
+
})) != null ? _useSubscribeToQueryC4 : 0;
|
|
544
|
+
if (!queryState) {
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
548
|
+
role: "button",
|
|
549
|
+
"aria-label": `Open query details for ${queryHash}`,
|
|
550
|
+
onClick: () => setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash),
|
|
551
|
+
style: {
|
|
552
|
+
display: 'flex',
|
|
553
|
+
borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
|
|
554
|
+
cursor: 'pointer',
|
|
555
|
+
background: queryHash === activeQueryHash ? 'rgba(255,255,255,.1)' : undefined
|
|
556
|
+
}
|
|
557
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
558
|
+
style: {
|
|
559
|
+
flex: '0 0 auto',
|
|
560
|
+
width: '2em',
|
|
561
|
+
height: '2em',
|
|
562
|
+
background: getQueryStatusColor({
|
|
563
|
+
queryState,
|
|
564
|
+
isStale,
|
|
565
|
+
observerCount,
|
|
566
|
+
theme: defaultTheme
|
|
567
|
+
}),
|
|
568
|
+
display: 'flex',
|
|
569
|
+
alignItems: 'center',
|
|
570
|
+
justifyContent: 'center',
|
|
571
|
+
fontWeight: 'bold',
|
|
572
|
+
textShadow: isStale ? '0' : '0 0 10px black',
|
|
573
|
+
color: isStale ? 'black' : 'white'
|
|
574
|
+
}
|
|
575
|
+
}, observerCount), isDisabled ? /*#__PURE__*/React.createElement("div", {
|
|
576
|
+
style: {
|
|
577
|
+
flex: '0 0 auto',
|
|
578
|
+
height: '2em',
|
|
579
|
+
background: defaultTheme.gray,
|
|
580
|
+
display: 'flex',
|
|
581
|
+
alignItems: 'center',
|
|
582
|
+
fontWeight: 'bold',
|
|
583
|
+
padding: '0 0.5em'
|
|
584
|
+
}
|
|
585
|
+
}, "disabled") : null, /*#__PURE__*/React.createElement(Code, {
|
|
586
|
+
style: {
|
|
587
|
+
padding: '.5em'
|
|
588
|
+
}
|
|
589
|
+
}, `${queryHash}`));
|
|
590
|
+
});
|
|
591
|
+
QueryRow.displayName = 'QueryRow';
|
|
592
|
+
var QueryRow$1 = QueryRow;
|
|
593
|
+
|
|
418
594
|
const Entry = styled('div', {
|
|
419
595
|
fontFamily: 'Menlo, monospace',
|
|
420
596
|
fontSize: '1em',
|
|
@@ -661,317 +837,323 @@ function Explorer({
|
|
|
661
837
|
});
|
|
662
838
|
}
|
|
663
839
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
width: "40px",
|
|
667
|
-
height: "40px",
|
|
668
|
-
viewBox: "0 0 190 190",
|
|
669
|
-
version: "1.1"
|
|
670
|
-
}, props), /*#__PURE__*/React__namespace.createElement("g", {
|
|
671
|
-
stroke: "none",
|
|
672
|
-
strokeWidth: "1",
|
|
673
|
-
fill: "none",
|
|
674
|
-
fillRule: "evenodd"
|
|
675
|
-
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
676
|
-
transform: "translate(-33.000000, 0.000000)"
|
|
677
|
-
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
678
|
-
d: "M72.7239712,61.3436237 C69.631224,46.362877 68.9675112,34.8727722 70.9666331,26.5293551 C72.1555965,21.5671678 74.3293088,17.5190846 77.6346064,14.5984631 C81.1241394,11.5150478 85.5360327,10.0020122 90.493257,10.0020122 C98.6712013,10.0020122 107.26826,13.7273214 116.455725,20.8044264 C120.20312,23.6910458 124.092437,27.170411 128.131651,31.2444746 C128.45314,30.8310265 128.816542,30.4410453 129.22143,30.0806152 C140.64098,19.9149716 150.255245,13.5989272 158.478408,11.1636507 C163.367899,9.715636 167.958526,9.57768202 172.138936,10.983031 C176.551631,12.4664684 180.06766,15.5329489 182.548314,19.8281091 C186.642288,26.9166735 187.721918,36.2310983 186.195595,47.7320243 C185.573451,52.4199112 184.50985,57.5263831 183.007094,63.0593153 C183.574045,63.1277086 184.142416,63.2532808 184.705041,63.4395297 C199.193932,68.2358678 209.453582,73.3937462 215.665021,79.2882839 C219.360669,82.7953831 221.773972,86.6998434 222.646365,91.0218204 C223.567176,95.5836746 222.669313,100.159332 220.191548,104.451297 C216.105211,111.529614 208.591643,117.11221 197.887587,121.534031 C193.589552,123.309539 188.726579,124.917559 183.293259,126.363748 C183.541176,126.92292 183.733521,127.516759 183.862138,128.139758 C186.954886,143.120505 187.618598,154.61061 185.619477,162.954027 C184.430513,167.916214 182.256801,171.964297 178.951503,174.884919 C175.46197,177.968334 171.050077,179.48137 166.092853,179.48137 C157.914908,179.48137 149.31785,175.756061 140.130385,168.678956 C136.343104,165.761613 132.410866,162.238839 128.325434,158.108619 C127.905075,158.765474 127.388968,159.376011 126.77857,159.919385 C115.35902,170.085028 105.744755,176.401073 97.5215915,178.836349 C92.6321009,180.284364 88.0414736,180.422318 83.8610636,179.016969 C79.4483686,177.533532 75.9323404,174.467051 73.4516862,170.171891 C69.3577116,163.083327 68.2780823,153.768902 69.8044053,142.267976 C70.449038,137.410634 71.56762,132.103898 73.1575891,126.339009 C72.5361041,126.276104 71.9120754,126.144816 71.2949591,125.940529 C56.8060684,121.144191 46.5464184,115.986312 40.3349789,110.091775 C36.6393312,106.584675 34.2260275,102.680215 33.3536352,98.3582381 C32.4328237,93.7963839 33.3306866,89.2207269 35.8084524,84.9287618 C39.8947886,77.8504443 47.4083565,72.2678481 58.1124133,67.8460273 C62.5385143,66.0176154 67.5637208,64.366822 73.1939394,62.8874674 C72.9933393,62.3969171 72.8349374,61.8811235 72.7239712,61.3436237 Z",
|
|
679
|
-
fill: "#002C4B",
|
|
680
|
-
fillRule: "nonzero",
|
|
681
|
-
transform: "translate(128.000000, 95.000000) scale(-1, 1) translate(-128.000000, -95.000000) "
|
|
682
|
-
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
683
|
-
d: "M113.396882,64 L142.608177,64 C144.399254,64 146.053521,64.958025 146.944933,66.5115174 L161.577138,92.0115174 C162.461464,93.5526583 162.461464,95.4473417 161.577138,96.9884826 L146.944933,122.488483 C146.053521,124.041975 144.399254,125 142.608177,125 L113.396882,125 C111.605806,125 109.951539,124.041975 109.060126,122.488483 L94.4279211,96.9884826 C93.543596,95.4473417 93.543596,93.5526583 94.4279211,92.0115174 L109.060126,66.5115174 C109.951539,64.958025 111.605806,64 113.396882,64 Z M138.987827,70.2765273 C140.779849,70.2765273 142.434839,71.2355558 143.325899,72.7903404 L154.343038,92.0138131 C155.225607,93.5537825 155.225607,95.4462175 154.343038,96.9861869 L143.325899,116.20966 C142.434839,117.764444 140.779849,118.723473 138.987827,118.723473 L117.017233,118.723473 C115.225211,118.723473 113.570221,117.764444 112.67916,116.20966 L101.662022,96.9861869 C100.779452,95.4462175 100.779452,93.5537825 101.662022,92.0138131 L112.67916,72.7903404 C113.570221,71.2355558 115.225211,70.2765273 117.017233,70.2765273 L138.987827,70.2765273 Z M135.080648,77.1414791 L120.924411,77.1414791 C119.134228,77.1414791 117.480644,78.0985567 116.5889,79.6508285 L116.5889,79.6508285 L109.489217,92.0093494 C108.603232,93.5515958 108.603232,95.4484042 109.489217,96.9906506 L109.489217,96.9906506 L116.5889,109.349172 C117.480644,110.901443 119.134228,111.858521 120.924411,111.858521 L120.924411,111.858521 L135.080648,111.858521 C136.870831,111.858521 138.524416,110.901443 139.41616,109.349172 L139.41616,109.349172 L146.515843,96.9906506 C147.401828,95.4484042 147.401828,93.5515958 146.515843,92.0093494 L146.515843,92.0093494 L139.41616,79.6508285 C138.524416,78.0985567 136.870831,77.1414791 135.080648,77.1414791 L135.080648,77.1414791 Z M131.319186,83.7122186 C133.108028,83.7122186 134.760587,84.6678753 135.652827,86.2183156 L138.983552,92.0060969 C139.87203,93.5500005 139.87203,95.4499995 138.983552,96.9939031 L135.652827,102.781684 C134.760587,104.332125 133.108028,105.287781 131.319186,105.287781 L124.685874,105.287781 C122.897032,105.287781 121.244473,104.332125 120.352233,102.781684 L117.021508,96.9939031 C116.13303,95.4499995 116.13303,93.5500005 117.021508,92.0060969 L120.352233,86.2183156 C121.244473,84.6678753 122.897032,83.7122186 124.685874,83.7122186 L131.319186,83.7122186 Z M128.003794,90.1848875 C126.459294,90.1848875 125.034382,91.0072828 124.263005,92.3424437 C123.491732,93.6774232 123.491732,95.3225768 124.263005,96.6575563 C125.034382,97.9927172 126.459294,98.8151125 128.001266,98.8151125 L128.001266,98.8151125 C129.545766,98.8151125 130.970678,97.9927172 131.742055,96.6575563 C132.513327,95.3225768 132.513327,93.6774232 131.742055,92.3424437 C130.970678,91.0072828 129.545766,90.1848875 128.003794,90.1848875 L128.003794,90.1848875 Z M93,94.5009646 L100.767764,94.5009646",
|
|
684
|
-
fill: "#FFD94C"
|
|
685
|
-
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
686
|
-
d: "M87.8601729,108.357758 C89.1715224,107.608286 90.8360246,108.074601 91.5779424,109.399303 L91.5779424,109.399303 L92.0525843,110.24352 C95.8563392,116.982993 99.8190116,123.380176 103.940602,129.435068 C108.807881,136.585427 114.28184,143.82411 120.362479,151.151115 C121.316878,152.30114 121.184944,154.011176 120.065686,154.997937 L120.065686,154.997937 L119.454208,155.534625 C99.3465389,173.103314 86.2778188,176.612552 80.2480482,166.062341 C74.3500652,155.742717 76.4844915,136.982888 86.6513274,109.782853 C86.876818,109.179582 87.3045861,108.675291 87.8601729,108.357758 Z M173.534177,129.041504 C174.986131,128.785177 176.375496,129.742138 176.65963,131.194242 L176.65963,131.194242 L176.812815,131.986376 C181.782365,157.995459 178.283348,171 166.315764,171 C154.609745,171 139.708724,159.909007 121.612702,137.727022 C121.211349,137.235047 120.994572,136.617371 121,135.981509 C121.013158,134.480686 122.235785,133.274651 123.730918,133.287756 L123.730918,133.287756 L124.684654,133.294531 C132.305698,133.335994 139.714387,133.071591 146.910723,132.501323 C155.409039,131.82788 164.283523,130.674607 173.534177,129.041504 Z M180.408726,73.8119663 C180.932139,72.4026903 182.508386,71.6634537 183.954581,72.149012 L183.954581,72.149012 L184.742552,72.4154854 C210.583763,81.217922 220.402356,90.8916805 214.198332,101.436761 C208.129904,111.751366 190.484347,119.260339 161.26166,123.963678 C160.613529,124.067994 159.948643,123.945969 159.382735,123.618843 C158.047025,122.846729 157.602046,121.158214 158.388848,119.847438 L158.388848,119.847438 L158.889328,119.0105 C162.877183,112.31633 166.481358,105.654262 169.701854,99.0242957 C173.50501,91.1948179 177.073967,82.7907081 180.408726,73.8119663 Z M94.7383398,66.0363218 C95.3864708,65.9320063 96.0513565,66.0540315 96.6172646,66.3811573 C97.9529754,67.153271 98.3979538,68.8417862 97.6111517,70.1525615 L97.6111517,70.1525615 L97.1106718,70.9895001 C93.1228168,77.6836699 89.5186416,84.3457379 86.2981462,90.9757043 C82.49499,98.8051821 78.9260328,107.209292 75.5912744,116.188034 C75.0678608,117.59731 73.4916142,118.336546 72.045419,117.850988 L72.045419,117.850988 L71.2574475,117.584515 C45.4162372,108.782078 35.597644,99.1083195 41.8016679,88.5632391 C47.8700957,78.2486335 65.515653,70.7396611 94.7383398,66.0363218 Z M136.545792,34.4653746 C156.653461,16.8966864 169.722181,13.3874478 175.751952,23.9376587 C181.649935,34.2572826 179.515508,53.0171122 169.348673,80.2171474 C169.123182,80.8204179 168.695414,81.324709 168.139827,81.6422422 C166.828478,82.3917144 165.163975,81.9253986 164.422058,80.6006966 L164.422058,80.6006966 L163.947416,79.7564798 C160.143661,73.0170065 156.180988,66.6198239 152.059398,60.564932 C147.192119,53.4145727 141.71816,46.1758903 135.637521,38.8488847 C134.683122,37.6988602 134.815056,35.9888243 135.934314,35.0020629 L135.934314,35.0020629 Z M90.6842361,18 C102.390255,18 117.291276,29.0909926 135.387298,51.2729777 C135.788651,51.7649527 136.005428,52.3826288 136,53.0184911 C135.986842,54.5193144 134.764215,55.7253489 133.269082,55.7122445 L133.269082,55.7122445 L132.315346,55.7054689 C124.694302,55.6640063 117.285613,55.9284091 110.089277,56.4986773 C101.590961,57.17212 92.7164767,58.325393 83.4658235,59.9584962 C82.0138691,60.2148231 80.6245044,59.2578618 80.3403697,57.805758 L80.3403697,57.805758 L80.1871846,57.0136235 C75.2176347,31.0045412 78.7166519,18 90.6842361,18 Z",
|
|
687
|
-
fill: "#FF4154"
|
|
688
|
-
}))));
|
|
689
|
-
}
|
|
840
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
841
|
+
function noop() {}
|
|
690
842
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
843
|
+
/**
|
|
844
|
+
* Panel for the query currently being inspected
|
|
845
|
+
*
|
|
846
|
+
* It displays query details (key, observers...), query actions,
|
|
847
|
+
* the data explorer and the query explorer
|
|
848
|
+
*/
|
|
849
|
+
const ActiveQuery = ({
|
|
850
|
+
queryCache,
|
|
851
|
+
activeQueryHash,
|
|
698
852
|
queryClient,
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
const
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
moveEvent.preventDefault();
|
|
727
|
-
|
|
728
|
-
// calculate the correct size based on mouse position and current panel position
|
|
729
|
-
// hint: it is different formula for the opposite sides
|
|
730
|
-
if (isVertical) {
|
|
731
|
-
newSize = width + (panelPosition === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX);
|
|
732
|
-
setDevtoolsWidth(newSize);
|
|
733
|
-
} else {
|
|
734
|
-
newSize = height + (panelPosition === 'bottom' ? startY - moveEvent.clientY : moveEvent.clientY - startY);
|
|
735
|
-
setDevtoolsHeight(newSize);
|
|
736
|
-
}
|
|
737
|
-
if (newSize < minPanelSize) {
|
|
738
|
-
setIsOpen(false);
|
|
739
|
-
} else {
|
|
740
|
-
setIsOpen(true);
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
const unsub = () => {
|
|
744
|
-
if (isResizing) {
|
|
745
|
-
setIsResizing(false);
|
|
746
|
-
}
|
|
747
|
-
document.removeEventListener('mousemove', run, false);
|
|
748
|
-
document.removeEventListener('mouseUp', unsub, false);
|
|
749
|
-
};
|
|
750
|
-
document.addEventListener('mousemove', run, false);
|
|
751
|
-
document.addEventListener('mouseup', unsub, false);
|
|
752
|
-
};
|
|
753
|
-
React__namespace.useEffect(() => {
|
|
754
|
-
setIsResolvedOpen(isOpen != null ? isOpen : false);
|
|
755
|
-
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
756
|
-
|
|
757
|
-
// Toggle panel visibility before/after transition (depending on direction).
|
|
758
|
-
// Prevents focusing in a closed panel.
|
|
759
|
-
React__namespace.useEffect(() => {
|
|
760
|
-
const ref = panelRef.current;
|
|
761
|
-
if (ref) {
|
|
762
|
-
const handlePanelTransitionStart = () => {
|
|
763
|
-
if (isResolvedOpen) {
|
|
764
|
-
ref.style.visibility = 'visible';
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
const handlePanelTransitionEnd = () => {
|
|
768
|
-
if (!isResolvedOpen) {
|
|
769
|
-
ref.style.visibility = 'hidden';
|
|
770
|
-
}
|
|
771
|
-
};
|
|
772
|
-
ref.addEventListener('transitionstart', handlePanelTransitionStart);
|
|
773
|
-
ref.addEventListener('transitionend', handlePanelTransitionEnd);
|
|
774
|
-
return () => {
|
|
775
|
-
ref.removeEventListener('transitionstart', handlePanelTransitionStart);
|
|
776
|
-
ref.removeEventListener('transitionend', handlePanelTransitionEnd);
|
|
777
|
-
};
|
|
853
|
+
errorTypes
|
|
854
|
+
}) => {
|
|
855
|
+
var _useSubscribeToQueryC, _useSubscribeToQueryC2;
|
|
856
|
+
const activeQuery = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash));
|
|
857
|
+
const activeQueryState = useSubscribeToQueryCache$1(queryCache, () => {
|
|
858
|
+
var _queryCache$getAll$fi;
|
|
859
|
+
return (_queryCache$getAll$fi = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi.state;
|
|
860
|
+
});
|
|
861
|
+
const isStale = (_useSubscribeToQueryC = useSubscribeToQueryCache$1(queryCache, () => {
|
|
862
|
+
var _queryCache$getAll$fi2;
|
|
863
|
+
return (_queryCache$getAll$fi2 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi2.isStale();
|
|
864
|
+
})) != null ? _useSubscribeToQueryC : false;
|
|
865
|
+
const observerCount = (_useSubscribeToQueryC2 = useSubscribeToQueryCache$1(queryCache, () => {
|
|
866
|
+
var _queryCache$getAll$fi3;
|
|
867
|
+
return (_queryCache$getAll$fi3 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi3.getObserversCount();
|
|
868
|
+
})) != null ? _useSubscribeToQueryC2 : 0;
|
|
869
|
+
const handleRefetch = () => {
|
|
870
|
+
const promise = activeQuery == null ? void 0 : activeQuery.fetch();
|
|
871
|
+
promise == null ? void 0 : promise.catch(noop);
|
|
872
|
+
};
|
|
873
|
+
const currentErrorTypeName = React.useMemo(() => {
|
|
874
|
+
if (activeQuery && activeQueryState != null && activeQueryState.error) {
|
|
875
|
+
const errorType = errorTypes.find(type => {
|
|
876
|
+
var _activeQueryState$err;
|
|
877
|
+
return type.initializer(activeQuery).toString() === ((_activeQueryState$err = activeQueryState.error) == null ? void 0 : _activeQueryState$err.toString());
|
|
878
|
+
});
|
|
879
|
+
return errorType == null ? void 0 : errorType.name;
|
|
778
880
|
}
|
|
779
|
-
return;
|
|
780
|
-
}, [
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
}) => ({
|
|
796
|
-
padding,
|
|
797
|
-
paddingTop,
|
|
798
|
-
paddingBottom,
|
|
799
|
-
paddingLeft,
|
|
800
|
-
paddingRight
|
|
801
|
-
}))(parentElement.style);
|
|
802
|
-
const run = () => {
|
|
803
|
-
// reset the padding
|
|
804
|
-
parentElement.style.padding = '0px';
|
|
805
|
-
parentElement.style.paddingTop = '0px';
|
|
806
|
-
parentElement.style.paddingBottom = '0px';
|
|
807
|
-
parentElement.style.paddingLeft = '0px';
|
|
808
|
-
parentElement.style.paddingRight = '0px';
|
|
809
|
-
// set the new padding based on the new panel position
|
|
810
|
-
|
|
811
|
-
parentElement.style[styleProp] = `${isVertical ? devtoolsWidth : devtoolsHeight}px`;
|
|
812
|
-
};
|
|
813
|
-
run();
|
|
814
|
-
if (typeof window !== 'undefined') {
|
|
815
|
-
window.addEventListener('resize', run);
|
|
816
|
-
return () => {
|
|
817
|
-
window.removeEventListener('resize', run);
|
|
818
|
-
Object.entries(previousPaddings).forEach(([property, previousValue]) => {
|
|
819
|
-
parentElement.style[property] = previousValue;
|
|
820
|
-
});
|
|
821
|
-
};
|
|
881
|
+
return undefined;
|
|
882
|
+
}, [activeQuery, activeQueryState == null ? void 0 : activeQueryState.error, errorTypes]);
|
|
883
|
+
if (!activeQuery || !activeQueryState) {
|
|
884
|
+
return null;
|
|
885
|
+
}
|
|
886
|
+
const triggerError = errorType => {
|
|
887
|
+
var _errorType$initialize;
|
|
888
|
+
const error = (_errorType$initialize = errorType == null ? void 0 : errorType.initializer(activeQuery)) != null ? _errorType$initialize : new Error('Unknown error from devtools');
|
|
889
|
+
const __previousQueryOptions = activeQuery.options;
|
|
890
|
+
activeQuery.setState({
|
|
891
|
+
status: 'error',
|
|
892
|
+
error,
|
|
893
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
894
|
+
fetchMeta: {
|
|
895
|
+
...activeQuery.state.fetchMeta,
|
|
896
|
+
__previousQueryOptions
|
|
822
897
|
}
|
|
898
|
+
});
|
|
899
|
+
};
|
|
900
|
+
const restoreQueryAfterLoadingOrError = () => {
|
|
901
|
+
activeQuery.fetch(activeQuery.state.fetchMeta.__previousQueryOptions, {
|
|
902
|
+
// Make sure this fetch will cancel the previous one
|
|
903
|
+
cancelRefetch: true
|
|
904
|
+
});
|
|
905
|
+
};
|
|
906
|
+
return /*#__PURE__*/React.createElement(ActiveQueryPanel, null, /*#__PURE__*/React.createElement("div", {
|
|
907
|
+
style: {
|
|
908
|
+
padding: '.5em',
|
|
909
|
+
background: defaultTheme.backgroundAlt,
|
|
910
|
+
position: 'sticky',
|
|
911
|
+
top: 0,
|
|
912
|
+
zIndex: 1
|
|
823
913
|
}
|
|
824
|
-
|
|
825
|
-
}, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth]);
|
|
826
|
-
const {
|
|
827
|
-
style: panelStyle = {},
|
|
828
|
-
...otherPanelProps
|
|
829
|
-
} = panelProps;
|
|
830
|
-
const {
|
|
831
|
-
style: toggleButtonStyle = {},
|
|
832
|
-
onClick: onToggleClick,
|
|
833
|
-
...otherToggleButtonProps
|
|
834
|
-
} = toggleButtonProps;
|
|
835
|
-
|
|
836
|
-
// get computed style based on panel position
|
|
837
|
-
const style = getSidePanelStyle({
|
|
838
|
-
position: panelPosition,
|
|
839
|
-
devtoolsTheme: defaultTheme,
|
|
840
|
-
isOpen: isResolvedOpen,
|
|
841
|
-
height: devtoolsHeight,
|
|
842
|
-
width: devtoolsWidth,
|
|
843
|
-
isResizing,
|
|
844
|
-
panelStyle
|
|
845
|
-
});
|
|
846
|
-
|
|
847
|
-
// Do not render on the server
|
|
848
|
-
if (!isMounted()) return null;
|
|
849
|
-
return /*#__PURE__*/React__namespace.createElement(Container, {
|
|
850
|
-
ref: rootRef,
|
|
851
|
-
className: "ReactQueryDevtools",
|
|
852
|
-
"aria-label": "React Query Devtools"
|
|
853
|
-
}, /*#__PURE__*/React__namespace.createElement(ThemeProvider, {
|
|
854
|
-
theme: defaultTheme
|
|
855
|
-
}, /*#__PURE__*/React__namespace.createElement(ReactQueryDevtoolsPanel$1, _extends({
|
|
856
|
-
ref: panelRef,
|
|
857
|
-
queryClient: queryClient,
|
|
858
|
-
styleNonce: styleNonce,
|
|
859
|
-
position: panelPosition,
|
|
860
|
-
onPositionChange: setPanelPosition,
|
|
861
|
-
showCloseButton: true,
|
|
862
|
-
closeButtonProps: closeButtonProps
|
|
863
|
-
}, otherPanelProps, {
|
|
864
|
-
style: style,
|
|
865
|
-
isOpen: isResolvedOpen,
|
|
866
|
-
setIsOpen: setIsOpen,
|
|
867
|
-
onDragStart: e => handleDragStart(panelRef.current, e),
|
|
868
|
-
errorTypes: errorTypes
|
|
869
|
-
}))), !isResolvedOpen ? /*#__PURE__*/React__namespace.createElement("button", _extends({
|
|
870
|
-
type: "button"
|
|
871
|
-
}, otherToggleButtonProps, {
|
|
872
|
-
"aria-label": "Open React Query Devtools",
|
|
873
|
-
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
874
|
-
"aria-haspopup": "true",
|
|
875
|
-
"aria-expanded": "false",
|
|
876
|
-
onClick: e => {
|
|
877
|
-
setIsOpen(true);
|
|
878
|
-
onToggleClick == null ? void 0 : onToggleClick(e);
|
|
879
|
-
},
|
|
914
|
+
}, "Query Details"), /*#__PURE__*/React.createElement("div", {
|
|
880
915
|
style: {
|
|
881
|
-
|
|
882
|
-
border: 0,
|
|
883
|
-
padding: 0,
|
|
884
|
-
position: 'fixed',
|
|
885
|
-
zIndex: 99999,
|
|
886
|
-
display: 'inline-flex',
|
|
887
|
-
fontSize: '1.5em',
|
|
888
|
-
margin: '.5em',
|
|
889
|
-
cursor: 'pointer',
|
|
890
|
-
width: 'fit-content',
|
|
891
|
-
...(position === 'top-right' ? {
|
|
892
|
-
top: '0',
|
|
893
|
-
right: '0'
|
|
894
|
-
} : position === 'top-left' ? {
|
|
895
|
-
top: '0',
|
|
896
|
-
left: '0'
|
|
897
|
-
} : position === 'bottom-right' ? {
|
|
898
|
-
bottom: '0',
|
|
899
|
-
right: '0'
|
|
900
|
-
} : {
|
|
901
|
-
bottom: '0',
|
|
902
|
-
left: '0'
|
|
903
|
-
}),
|
|
904
|
-
...toggleButtonStyle
|
|
916
|
+
padding: '.5em'
|
|
905
917
|
}
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
const useSubscribeToQueryCache = (queryCache, getSnapshot, skip = false) => {
|
|
913
|
-
return React__namespace.useSyncExternalStore(React__namespace.useCallback(onStoreChange => {
|
|
914
|
-
if (!skip) return queryCache.subscribe(reactQuery.notifyManager.batchCalls(onStoreChange));
|
|
915
|
-
return () => {
|
|
916
|
-
return;
|
|
917
|
-
};
|
|
918
|
-
}, [queryCache, skip]), getSnapshot, getSnapshot);
|
|
919
|
-
};
|
|
920
|
-
const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
|
|
921
|
-
const {
|
|
922
|
-
isOpen = true,
|
|
923
|
-
styleNonce,
|
|
924
|
-
setIsOpen,
|
|
925
|
-
queryClient,
|
|
926
|
-
onDragStart,
|
|
927
|
-
onPositionChange,
|
|
928
|
-
showCloseButton,
|
|
929
|
-
position,
|
|
930
|
-
closeButtonProps = {},
|
|
931
|
-
errorTypes = [],
|
|
932
|
-
...panelProps
|
|
933
|
-
} = props;
|
|
934
|
-
const {
|
|
935
|
-
onClick: onCloseClick,
|
|
936
|
-
...otherCloseButtonProps
|
|
937
|
-
} = closeButtonProps;
|
|
938
|
-
const client = reactQuery.useQueryClient(queryClient);
|
|
939
|
-
const queryCache = client.getQueryCache();
|
|
940
|
-
const [sort, setSort] = useLocalStorage('reactQueryDevtoolsSortFn', Object.keys(sortFns)[0]);
|
|
941
|
-
const [filter, setFilter] = useLocalStorage('reactQueryDevtoolsFilter', '');
|
|
942
|
-
const [baseSort, setBaseSort] = useLocalStorage('reactQueryDevtoolsBaseSort', 1);
|
|
943
|
-
const sortFn = React__namespace.useMemo(() => sortFns[sort], [sort]);
|
|
944
|
-
const queriesCount = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().length, !isOpen);
|
|
945
|
-
const [activeQueryHash, setActiveQueryHash] = useLocalStorage('reactQueryDevtoolsActiveQueryHash', '');
|
|
946
|
-
const queries = React__namespace.useMemo(() => {
|
|
947
|
-
const unsortedQueries = queryCache.getAll();
|
|
948
|
-
if (queriesCount === 0) {
|
|
949
|
-
return [];
|
|
918
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
919
|
+
style: {
|
|
920
|
+
marginBottom: '.5em',
|
|
921
|
+
display: 'flex',
|
|
922
|
+
alignItems: 'flex-start',
|
|
923
|
+
justifyContent: 'space-between'
|
|
950
924
|
}
|
|
951
|
-
|
|
952
|
-
const sorted = sortFn ? filtered.sort((a, b) => sortFn(a, b) * baseSort) : filtered;
|
|
953
|
-
return sorted;
|
|
954
|
-
}, [baseSort, sortFn, filter, queriesCount, queryCache]);
|
|
955
|
-
const [isMockOffline, setMockOffline] = React__namespace.useState(false);
|
|
956
|
-
return /*#__PURE__*/React__namespace.createElement(ThemeProvider, {
|
|
957
|
-
theme: defaultTheme
|
|
958
|
-
}, /*#__PURE__*/React__namespace.createElement(Panel, _extends({
|
|
959
|
-
ref: ref,
|
|
960
|
-
className: "ReactQueryDevtoolsPanel",
|
|
961
|
-
"aria-label": "React Query Devtools Panel",
|
|
962
|
-
id: "ReactQueryDevtoolsPanel"
|
|
963
|
-
}, panelProps, {
|
|
925
|
+
}, /*#__PURE__*/React.createElement(Code, {
|
|
964
926
|
style: {
|
|
965
|
-
|
|
966
|
-
position: 'relative',
|
|
967
|
-
...panelProps.style
|
|
927
|
+
lineHeight: '1.8em'
|
|
968
928
|
}
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
929
|
+
}, /*#__PURE__*/React.createElement("pre", {
|
|
930
|
+
style: {
|
|
931
|
+
margin: 0,
|
|
932
|
+
padding: 0,
|
|
933
|
+
overflow: 'auto'
|
|
934
|
+
}
|
|
935
|
+
}, displayValue(activeQuery.queryKey, true))), /*#__PURE__*/React.createElement("span", {
|
|
936
|
+
style: {
|
|
937
|
+
padding: '0.3em .6em',
|
|
938
|
+
borderRadius: '0.4em',
|
|
939
|
+
fontWeight: 'bold',
|
|
940
|
+
textShadow: '0 2px 10px black',
|
|
941
|
+
background: getQueryStatusColor({
|
|
942
|
+
queryState: activeQueryState,
|
|
943
|
+
isStale: isStale,
|
|
944
|
+
observerCount: observerCount,
|
|
945
|
+
theme: defaultTheme
|
|
946
|
+
}),
|
|
947
|
+
flexShrink: 0
|
|
948
|
+
}
|
|
949
|
+
}, getQueryStatusLabel(activeQuery))), /*#__PURE__*/React.createElement("div", {
|
|
950
|
+
style: {
|
|
951
|
+
marginBottom: '.5em',
|
|
952
|
+
display: 'flex',
|
|
953
|
+
alignItems: 'center',
|
|
954
|
+
justifyContent: 'space-between'
|
|
955
|
+
}
|
|
956
|
+
}, "Observers: ", /*#__PURE__*/React.createElement(Code, null, observerCount)), /*#__PURE__*/React.createElement("div", {
|
|
957
|
+
style: {
|
|
958
|
+
display: 'flex',
|
|
959
|
+
alignItems: 'center',
|
|
960
|
+
justifyContent: 'space-between'
|
|
961
|
+
}
|
|
962
|
+
}, "Last Updated:", ' ', /*#__PURE__*/React.createElement(Code, null, new Date(activeQueryState.dataUpdatedAt).toLocaleTimeString()))), /*#__PURE__*/React.createElement("div", {
|
|
963
|
+
style: {
|
|
964
|
+
background: defaultTheme.backgroundAlt,
|
|
965
|
+
padding: '.5em',
|
|
966
|
+
position: 'sticky',
|
|
967
|
+
top: 0,
|
|
968
|
+
zIndex: 1
|
|
969
|
+
}
|
|
970
|
+
}, "Actions"), /*#__PURE__*/React.createElement("div", {
|
|
971
|
+
style: {
|
|
972
|
+
padding: '0.5em',
|
|
973
|
+
display: 'flex',
|
|
974
|
+
flexWrap: 'wrap',
|
|
975
|
+
gap: '0.5em',
|
|
976
|
+
alignItems: 'flex-end'
|
|
977
|
+
}
|
|
978
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
979
|
+
type: "button",
|
|
980
|
+
onClick: handleRefetch,
|
|
981
|
+
disabled: activeQueryState.fetchStatus === 'fetching',
|
|
982
|
+
style: {
|
|
983
|
+
background: defaultTheme.active
|
|
984
|
+
}
|
|
985
|
+
}, "Refetch"), ' ', /*#__PURE__*/React.createElement(Button, {
|
|
986
|
+
type: "button",
|
|
987
|
+
onClick: () => queryClient.invalidateQueries(activeQuery),
|
|
988
|
+
style: {
|
|
989
|
+
background: defaultTheme.warning,
|
|
990
|
+
color: defaultTheme.inputTextColor
|
|
991
|
+
}
|
|
992
|
+
}, "Invalidate"), ' ', /*#__PURE__*/React.createElement(Button, {
|
|
993
|
+
type: "button",
|
|
994
|
+
onClick: () => queryClient.resetQueries(activeQuery),
|
|
995
|
+
style: {
|
|
996
|
+
background: defaultTheme.gray
|
|
997
|
+
}
|
|
998
|
+
}, "Reset"), ' ', /*#__PURE__*/React.createElement(Button, {
|
|
999
|
+
type: "button",
|
|
1000
|
+
onClick: () => queryClient.removeQueries(activeQuery),
|
|
1001
|
+
style: {
|
|
1002
|
+
background: defaultTheme.danger
|
|
1003
|
+
}
|
|
1004
|
+
}, "Remove"), ' ', /*#__PURE__*/React.createElement(Button, {
|
|
1005
|
+
type: "button",
|
|
1006
|
+
onClick: () => {
|
|
1007
|
+
if (activeQuery.state.data === undefined) {
|
|
1008
|
+
restoreQueryAfterLoadingOrError();
|
|
1009
|
+
} else {
|
|
1010
|
+
const __previousQueryOptions = activeQuery.options;
|
|
1011
|
+
// Trigger a fetch in order to trigger suspense as well.
|
|
1012
|
+
activeQuery.fetch({
|
|
1013
|
+
...__previousQueryOptions,
|
|
1014
|
+
queryFn: () => {
|
|
1015
|
+
return new Promise(() => {
|
|
1016
|
+
// Never resolve
|
|
1017
|
+
});
|
|
1018
|
+
},
|
|
1019
|
+
gcTime: -1
|
|
1020
|
+
});
|
|
1021
|
+
activeQuery.setState({
|
|
1022
|
+
data: undefined,
|
|
1023
|
+
status: 'pending',
|
|
1024
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
1025
|
+
fetchMeta: {
|
|
1026
|
+
...activeQuery.state.fetchMeta,
|
|
1027
|
+
__previousQueryOptions
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
},
|
|
1032
|
+
style: {
|
|
1033
|
+
background: defaultTheme.paused
|
|
1034
|
+
}
|
|
1035
|
+
}, activeQuery.state.status === 'pending' ? 'Restore' : 'Trigger', ' ', "loading"), ' ', errorTypes.length === 0 || activeQuery.state.status === 'error' ? /*#__PURE__*/React.createElement(Button, {
|
|
1036
|
+
type: "button",
|
|
1037
|
+
onClick: () => {
|
|
1038
|
+
if (!activeQuery.state.error) {
|
|
1039
|
+
triggerError();
|
|
1040
|
+
} else {
|
|
1041
|
+
queryClient.resetQueries(activeQuery);
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
style: {
|
|
1045
|
+
background: defaultTheme.danger
|
|
1046
|
+
}
|
|
1047
|
+
}, activeQuery.state.status === 'error' ? 'Restore' : 'Trigger', " error") : /*#__PURE__*/React.createElement("label", null, "Trigger error:", /*#__PURE__*/React.createElement(Select, {
|
|
1048
|
+
value: currentErrorTypeName != null ? currentErrorTypeName : '',
|
|
1049
|
+
style: {
|
|
1050
|
+
marginInlineStart: '.5em'
|
|
1051
|
+
},
|
|
1052
|
+
onChange: e => {
|
|
1053
|
+
const errorType = errorTypes.find(t => t.name === e.target.value);
|
|
1054
|
+
triggerError(errorType);
|
|
1055
|
+
}
|
|
1056
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
1057
|
+
key: "",
|
|
1058
|
+
value: ""
|
|
1059
|
+
}), errorTypes.map(errorType => /*#__PURE__*/React.createElement("option", {
|
|
1060
|
+
key: errorType.name,
|
|
1061
|
+
value: errorType.name
|
|
1062
|
+
}, errorType.name))))), /*#__PURE__*/React.createElement("div", {
|
|
1063
|
+
style: {
|
|
1064
|
+
background: defaultTheme.backgroundAlt,
|
|
1065
|
+
padding: '.5em',
|
|
1066
|
+
position: 'sticky',
|
|
1067
|
+
top: 0,
|
|
1068
|
+
zIndex: 1
|
|
1069
|
+
}
|
|
1070
|
+
}, "Data Explorer"), /*#__PURE__*/React.createElement("div", {
|
|
1071
|
+
style: {
|
|
1072
|
+
padding: '.5em'
|
|
1073
|
+
}
|
|
1074
|
+
}, /*#__PURE__*/React.createElement(Explorer, {
|
|
1075
|
+
label: "Data",
|
|
1076
|
+
value: activeQueryState.data,
|
|
1077
|
+
defaultExpanded: {},
|
|
1078
|
+
copyable: true
|
|
1079
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
1080
|
+
style: {
|
|
1081
|
+
background: defaultTheme.backgroundAlt,
|
|
1082
|
+
padding: '.5em',
|
|
1083
|
+
position: 'sticky',
|
|
1084
|
+
top: 0,
|
|
1085
|
+
zIndex: 1
|
|
1086
|
+
}
|
|
1087
|
+
}, "Query Explorer"), /*#__PURE__*/React.createElement("div", {
|
|
1088
|
+
style: {
|
|
1089
|
+
padding: '.5em'
|
|
1090
|
+
}
|
|
1091
|
+
}, /*#__PURE__*/React.createElement(Explorer, {
|
|
1092
|
+
label: "Query",
|
|
1093
|
+
value: activeQuery,
|
|
1094
|
+
defaultExpanded: {
|
|
1095
|
+
queryKey: true
|
|
1096
|
+
}
|
|
1097
|
+
})));
|
|
1098
|
+
};
|
|
1099
|
+
ActiveQuery.displayName = 'ActiveQuery';
|
|
1100
|
+
var ActiveQuery$1 = ActiveQuery;
|
|
1101
|
+
|
|
1102
|
+
const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
|
|
1103
|
+
const {
|
|
1104
|
+
isOpen = true,
|
|
1105
|
+
styleNonce,
|
|
1106
|
+
setIsOpen,
|
|
1107
|
+
queryClient,
|
|
1108
|
+
onDragStart,
|
|
1109
|
+
onPositionChange,
|
|
1110
|
+
showCloseButton,
|
|
1111
|
+
position,
|
|
1112
|
+
closeButtonProps = {},
|
|
1113
|
+
errorTypes = [],
|
|
1114
|
+
...panelProps
|
|
1115
|
+
} = props;
|
|
1116
|
+
const {
|
|
1117
|
+
onClick: onCloseClick,
|
|
1118
|
+
...otherCloseButtonProps
|
|
1119
|
+
} = closeButtonProps;
|
|
1120
|
+
const client = reactQuery.useQueryClient(queryClient);
|
|
1121
|
+
const queryCache = client.getQueryCache();
|
|
1122
|
+
const [sort, setSort] = useLocalStorage('reactQueryDevtoolsSortFn', Object.keys(sortFns)[0]);
|
|
1123
|
+
const [filter, setFilter] = useLocalStorage('reactQueryDevtoolsFilter', '');
|
|
1124
|
+
const [baseSort, setBaseSort] = useLocalStorage('reactQueryDevtoolsBaseSort', 1);
|
|
1125
|
+
const sortFn = React.useMemo(() => sortFns[sort], [sort]);
|
|
1126
|
+
const queriesCount = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().length, !isOpen);
|
|
1127
|
+
const [activeQueryHash, setActiveQueryHash] = useLocalStorage('reactQueryDevtoolsActiveQueryHash', '');
|
|
1128
|
+
const queries = React.useMemo(() => {
|
|
1129
|
+
const unsortedQueries = queryCache.getAll();
|
|
1130
|
+
if (queriesCount === 0) {
|
|
1131
|
+
return [];
|
|
1132
|
+
}
|
|
1133
|
+
const filtered = filter ? unsortedQueries.filter(item => matchSorterUtils.rankItem(item.queryHash, filter).passed) : [...unsortedQueries];
|
|
1134
|
+
const sorted = sortFn ? filtered.sort((a, b) => sortFn(a, b) * baseSort) : filtered;
|
|
1135
|
+
return sorted;
|
|
1136
|
+
}, [baseSort, sortFn, filter, queriesCount, queryCache]);
|
|
1137
|
+
const [isMockOffline, setMockOffline] = React.useState(false);
|
|
1138
|
+
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
1139
|
+
theme: defaultTheme
|
|
1140
|
+
}, /*#__PURE__*/React.createElement(Panel, _extends({
|
|
1141
|
+
ref: ref,
|
|
1142
|
+
className: "ReactQueryDevtoolsPanel",
|
|
1143
|
+
"aria-label": "React Query Devtools Panel",
|
|
1144
|
+
id: "ReactQueryDevtoolsPanel"
|
|
1145
|
+
}, panelProps, {
|
|
1146
|
+
style: {
|
|
1147
|
+
height: defaultPanelSize,
|
|
1148
|
+
position: 'relative',
|
|
1149
|
+
...panelProps.style
|
|
1150
|
+
}
|
|
1151
|
+
}), /*#__PURE__*/React.createElement("style", {
|
|
1152
|
+
nonce: styleNonce,
|
|
1153
|
+
dangerouslySetInnerHTML: {
|
|
1154
|
+
__html: `
|
|
1155
|
+
.ReactQueryDevtoolsPanel * {
|
|
1156
|
+
scrollbar-color: ${defaultTheme.backgroundAlt} ${defaultTheme.gray};
|
|
975
1157
|
}
|
|
976
1158
|
|
|
977
1159
|
.ReactQueryDevtoolsPanel *::-webkit-scrollbar, .ReactQueryDevtoolsPanel scrollbar {
|
|
@@ -990,10 +1172,10 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
990
1172
|
}
|
|
991
1173
|
`
|
|
992
1174
|
}
|
|
993
|
-
}), /*#__PURE__*/
|
|
1175
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
994
1176
|
style: getResizeHandleStyle(position),
|
|
995
1177
|
onMouseDown: onDragStart
|
|
996
|
-
}), isOpen && /*#__PURE__*/
|
|
1178
|
+
}), isOpen && /*#__PURE__*/React.createElement("div", {
|
|
997
1179
|
style: {
|
|
998
1180
|
flex: '1 1 500px',
|
|
999
1181
|
minHeight: '40%',
|
|
@@ -1003,7 +1185,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1003
1185
|
display: 'flex',
|
|
1004
1186
|
flexDirection: 'column'
|
|
1005
1187
|
}
|
|
1006
|
-
}, /*#__PURE__*/
|
|
1188
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1007
1189
|
style: {
|
|
1008
1190
|
padding: '.5em',
|
|
1009
1191
|
background: defaultTheme.backgroundAlt,
|
|
@@ -1011,7 +1193,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1011
1193
|
justifyContent: 'space-between',
|
|
1012
1194
|
alignItems: 'center'
|
|
1013
1195
|
}
|
|
1014
|
-
}, /*#__PURE__*/
|
|
1196
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
1015
1197
|
type: "button",
|
|
1016
1198
|
"aria-label": "Close React Query Devtools",
|
|
1017
1199
|
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
@@ -1026,47 +1208,47 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1026
1208
|
marginRight: '.5em',
|
|
1027
1209
|
cursor: 'pointer'
|
|
1028
1210
|
}
|
|
1029
|
-
}, /*#__PURE__*/
|
|
1211
|
+
}, /*#__PURE__*/React.createElement(Logo, {
|
|
1030
1212
|
"aria-hidden": true
|
|
1031
|
-
}), /*#__PURE__*/
|
|
1213
|
+
}), /*#__PURE__*/React.createElement(ScreenReader, {
|
|
1032
1214
|
text: "Close React Query Devtools"
|
|
1033
|
-
})), /*#__PURE__*/
|
|
1215
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
1034
1216
|
style: {
|
|
1035
1217
|
display: 'flex',
|
|
1036
1218
|
flexDirection: 'column'
|
|
1037
1219
|
}
|
|
1038
|
-
}, /*#__PURE__*/
|
|
1220
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1039
1221
|
style: {
|
|
1040
1222
|
display: 'flex',
|
|
1041
1223
|
justifyContent: 'space-between',
|
|
1042
1224
|
alignItems: 'center',
|
|
1043
1225
|
marginBottom: '.5em'
|
|
1044
1226
|
}
|
|
1045
|
-
}, /*#__PURE__*/
|
|
1227
|
+
}, /*#__PURE__*/React.createElement(QueryStatusCount, {
|
|
1046
1228
|
queryCache: queryCache
|
|
1047
|
-
}), position && onPositionChange ? /*#__PURE__*/
|
|
1229
|
+
}), position && onPositionChange ? /*#__PURE__*/React.createElement(Select, {
|
|
1048
1230
|
"aria-label": "Panel position",
|
|
1049
1231
|
value: position,
|
|
1050
1232
|
style: {
|
|
1051
1233
|
marginInlineStart: '.5em'
|
|
1052
1234
|
},
|
|
1053
1235
|
onChange: e => onPositionChange(e.target.value)
|
|
1054
|
-
}, /*#__PURE__*/
|
|
1236
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
1055
1237
|
value: "left"
|
|
1056
|
-
}, "Left"), /*#__PURE__*/
|
|
1238
|
+
}, "Left"), /*#__PURE__*/React.createElement("option", {
|
|
1057
1239
|
value: "right"
|
|
1058
|
-
}, "Right"), /*#__PURE__*/
|
|
1240
|
+
}, "Right"), /*#__PURE__*/React.createElement("option", {
|
|
1059
1241
|
value: "top"
|
|
1060
|
-
}, "Top"), /*#__PURE__*/
|
|
1242
|
+
}, "Top"), /*#__PURE__*/React.createElement("option", {
|
|
1061
1243
|
value: "bottom"
|
|
1062
|
-
}, "Bottom")) : null), /*#__PURE__*/
|
|
1244
|
+
}, "Bottom")) : null), /*#__PURE__*/React.createElement("div", {
|
|
1063
1245
|
style: {
|
|
1064
1246
|
display: 'flex',
|
|
1065
1247
|
alignItems: 'center',
|
|
1066
1248
|
flexWrap: 'wrap',
|
|
1067
1249
|
gap: '0.5em'
|
|
1068
1250
|
}
|
|
1069
|
-
}, /*#__PURE__*/
|
|
1251
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
1070
1252
|
placeholder: "Filter",
|
|
1071
1253
|
"aria-label": "Filter by queryhash",
|
|
1072
1254
|
value: filter != null ? filter : '',
|
|
@@ -1078,7 +1260,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1078
1260
|
flex: '1',
|
|
1079
1261
|
width: '100%'
|
|
1080
1262
|
}
|
|
1081
|
-
}), /*#__PURE__*/
|
|
1263
|
+
}), /*#__PURE__*/React.createElement(Select, {
|
|
1082
1264
|
"aria-label": "Sort queries",
|
|
1083
1265
|
value: sort,
|
|
1084
1266
|
onChange: e => setSort(e.target.value),
|
|
@@ -1087,17 +1269,17 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1087
1269
|
minWidth: 75,
|
|
1088
1270
|
marginRight: '.5em'
|
|
1089
1271
|
}
|
|
1090
|
-
}, Object.keys(sortFns).map(key => /*#__PURE__*/
|
|
1272
|
+
}, Object.keys(sortFns).map(key => /*#__PURE__*/React.createElement("option", {
|
|
1091
1273
|
key: key,
|
|
1092
1274
|
value: key
|
|
1093
|
-
}, "Sort by ", key))), /*#__PURE__*/
|
|
1275
|
+
}, "Sort by ", key))), /*#__PURE__*/React.createElement(Button, {
|
|
1094
1276
|
type: "button",
|
|
1095
1277
|
onClick: () => setBaseSort(old => old * -1),
|
|
1096
1278
|
style: {
|
|
1097
1279
|
padding: '.3em .4em',
|
|
1098
1280
|
marginRight: '.5em'
|
|
1099
1281
|
}
|
|
1100
|
-
}, baseSort === 1 ? '⬆ Asc' : '⬇ Desc'), /*#__PURE__*/
|
|
1282
|
+
}, baseSort === 1 ? '⬆ Asc' : '⬇ Desc'), /*#__PURE__*/React.createElement(Button, {
|
|
1101
1283
|
type: "button",
|
|
1102
1284
|
onClick: () => {
|
|
1103
1285
|
if (isMockOffline) {
|
|
@@ -1116,69 +1298,69 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1116
1298
|
padding: '0',
|
|
1117
1299
|
height: '2em'
|
|
1118
1300
|
}
|
|
1119
|
-
}, /*#__PURE__*/
|
|
1301
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
1120
1302
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1121
1303
|
width: "2em",
|
|
1122
1304
|
height: "2em",
|
|
1123
1305
|
viewBox: "0 0 24 24",
|
|
1124
1306
|
stroke: isMockOffline ? defaultTheme.danger : 'currentColor',
|
|
1125
1307
|
fill: "none"
|
|
1126
|
-
}, isMockOffline ? /*#__PURE__*/
|
|
1308
|
+
}, isMockOffline ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("path", {
|
|
1127
1309
|
stroke: "none",
|
|
1128
1310
|
d: "M0 0h24v24H0z",
|
|
1129
1311
|
fill: "none"
|
|
1130
|
-
}), /*#__PURE__*/
|
|
1312
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
1131
1313
|
x1: "12",
|
|
1132
1314
|
y1: "18",
|
|
1133
1315
|
x2: "12.01",
|
|
1134
1316
|
y2: "18"
|
|
1135
|
-
}), /*#__PURE__*/
|
|
1317
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
1136
1318
|
d: "M9.172 15.172a4 4 0 0 1 5.656 0"
|
|
1137
|
-
}), /*#__PURE__*/
|
|
1319
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
1138
1320
|
d: "M6.343 12.343a7.963 7.963 0 0 1 3.864 -2.14m4.163 .155a7.965 7.965 0 0 1 3.287 2"
|
|
1139
|
-
}), /*#__PURE__*/
|
|
1321
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
1140
1322
|
d: "M3.515 9.515a12 12 0 0 1 3.544 -2.455m3.101 -.92a12 12 0 0 1 10.325 3.374"
|
|
1141
|
-
}), /*#__PURE__*/
|
|
1323
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
1142
1324
|
x1: "3",
|
|
1143
1325
|
y1: "3",
|
|
1144
1326
|
x2: "21",
|
|
1145
1327
|
y2: "21"
|
|
1146
|
-
})) : /*#__PURE__*/
|
|
1328
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("path", {
|
|
1147
1329
|
stroke: "none",
|
|
1148
1330
|
d: "M0 0h24v24H0z",
|
|
1149
1331
|
fill: "none"
|
|
1150
|
-
}), /*#__PURE__*/
|
|
1332
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
1151
1333
|
x1: "12",
|
|
1152
1334
|
y1: "18",
|
|
1153
1335
|
x2: "12.01",
|
|
1154
1336
|
y2: "18"
|
|
1155
|
-
}), /*#__PURE__*/
|
|
1337
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
1156
1338
|
d: "M9.172 15.172a4 4 0 0 1 5.656 0"
|
|
1157
|
-
}), /*#__PURE__*/
|
|
1339
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
1158
1340
|
d: "M6.343 12.343a8 8 0 0 1 11.314 0"
|
|
1159
|
-
}), /*#__PURE__*/
|
|
1341
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
1160
1342
|
d: "M3.515 9.515c4.686 -4.687 12.284 -4.687 17 0"
|
|
1161
|
-
}))), /*#__PURE__*/
|
|
1343
|
+
}))), /*#__PURE__*/React.createElement(ScreenReader, {
|
|
1162
1344
|
text: isMockOffline ? 'Restore offline mock' : 'Mock offline behavior'
|
|
1163
|
-
}))))), /*#__PURE__*/
|
|
1345
|
+
}))))), /*#__PURE__*/React.createElement("div", {
|
|
1164
1346
|
style: {
|
|
1165
1347
|
overflowY: 'auto',
|
|
1166
1348
|
flex: '1'
|
|
1167
1349
|
}
|
|
1168
1350
|
}, queries.map(query => {
|
|
1169
|
-
return /*#__PURE__*/
|
|
1351
|
+
return /*#__PURE__*/React.createElement(QueryRow$1, {
|
|
1170
1352
|
queryKey: query.queryKey,
|
|
1171
1353
|
activeQueryHash: activeQueryHash,
|
|
1172
1354
|
setActiveQueryHash: setActiveQueryHash,
|
|
1173
1355
|
key: query.queryHash,
|
|
1174
1356
|
queryCache: queryCache
|
|
1175
1357
|
});
|
|
1176
|
-
}))), activeQueryHash && isOpen ? /*#__PURE__*/
|
|
1358
|
+
}))), activeQueryHash && isOpen ? /*#__PURE__*/React.createElement(ActiveQuery$1, {
|
|
1177
1359
|
activeQueryHash: activeQueryHash,
|
|
1178
1360
|
queryCache: queryCache,
|
|
1179
1361
|
queryClient: client,
|
|
1180
1362
|
errorTypes: errorTypes
|
|
1181
|
-
}) : null, showCloseButton ? /*#__PURE__*/
|
|
1363
|
+
}) : null, showCloseButton ? /*#__PURE__*/React.createElement(Button, _extends({
|
|
1182
1364
|
type: "button",
|
|
1183
1365
|
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
1184
1366
|
"aria-haspopup": "true",
|
|
@@ -1198,383 +1380,233 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(funct
|
|
|
1198
1380
|
}
|
|
1199
1381
|
}), "Close") : null));
|
|
1200
1382
|
});
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1383
|
+
ReactQueryDevtoolsPanel$1.displayName = 'ReactQueryDevtoolsPanel';
|
|
1384
|
+
var ReactQueryDevtoolsPanel$2 = ReactQueryDevtoolsPanel$1;
|
|
1385
|
+
|
|
1386
|
+
function ReactQueryDevtools$1({
|
|
1387
|
+
initialIsOpen,
|
|
1388
|
+
panelProps = {},
|
|
1389
|
+
closeButtonProps = {},
|
|
1390
|
+
toggleButtonProps = {},
|
|
1391
|
+
position = 'bottom-left',
|
|
1392
|
+
containerElement: Container = 'aside',
|
|
1204
1393
|
queryClient,
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
const
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
var _errorType$initialize;
|
|
1240
|
-
const error = (_errorType$initialize = errorType == null ? void 0 : errorType.initializer(activeQuery)) != null ? _errorType$initialize : new Error('Unknown error from devtools');
|
|
1241
|
-
const __previousQueryOptions = activeQuery.options;
|
|
1242
|
-
activeQuery.setState({
|
|
1243
|
-
status: 'error',
|
|
1244
|
-
error,
|
|
1245
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
1246
|
-
fetchMeta: {
|
|
1247
|
-
...activeQuery.state.fetchMeta,
|
|
1248
|
-
__previousQueryOptions
|
|
1249
|
-
}
|
|
1250
|
-
});
|
|
1251
|
-
};
|
|
1252
|
-
const restoreQueryAfterLoadingOrError = () => {
|
|
1253
|
-
activeQuery.fetch(activeQuery.state.fetchMeta.__previousQueryOptions, {
|
|
1254
|
-
// Make sure this fetch will cancel the previous one
|
|
1255
|
-
cancelRefetch: true
|
|
1256
|
-
});
|
|
1257
|
-
};
|
|
1258
|
-
return /*#__PURE__*/React__namespace.createElement(ActiveQueryPanel, null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
1259
|
-
style: {
|
|
1260
|
-
padding: '.5em',
|
|
1261
|
-
background: defaultTheme.backgroundAlt,
|
|
1262
|
-
position: 'sticky',
|
|
1263
|
-
top: 0,
|
|
1264
|
-
zIndex: 1
|
|
1265
|
-
}
|
|
1266
|
-
}, "Query Details"), /*#__PURE__*/React__namespace.createElement("div", {
|
|
1267
|
-
style: {
|
|
1268
|
-
padding: '.5em'
|
|
1269
|
-
}
|
|
1270
|
-
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
1271
|
-
style: {
|
|
1272
|
-
marginBottom: '.5em',
|
|
1273
|
-
display: 'flex',
|
|
1274
|
-
alignItems: 'flex-start',
|
|
1275
|
-
justifyContent: 'space-between'
|
|
1276
|
-
}
|
|
1277
|
-
}, /*#__PURE__*/React__namespace.createElement(Code, {
|
|
1278
|
-
style: {
|
|
1279
|
-
lineHeight: '1.8em'
|
|
1280
|
-
}
|
|
1281
|
-
}, /*#__PURE__*/React__namespace.createElement("pre", {
|
|
1282
|
-
style: {
|
|
1283
|
-
margin: 0,
|
|
1284
|
-
padding: 0,
|
|
1285
|
-
overflow: 'auto'
|
|
1286
|
-
}
|
|
1287
|
-
}, displayValue(activeQuery.queryKey, true))), /*#__PURE__*/React__namespace.createElement("span", {
|
|
1288
|
-
style: {
|
|
1289
|
-
padding: '0.3em .6em',
|
|
1290
|
-
borderRadius: '0.4em',
|
|
1291
|
-
fontWeight: 'bold',
|
|
1292
|
-
textShadow: '0 2px 10px black',
|
|
1293
|
-
background: getQueryStatusColor({
|
|
1294
|
-
queryState: activeQueryState,
|
|
1295
|
-
isStale: isStale,
|
|
1296
|
-
observerCount: observerCount,
|
|
1297
|
-
theme: defaultTheme
|
|
1298
|
-
}),
|
|
1299
|
-
flexShrink: 0
|
|
1300
|
-
}
|
|
1301
|
-
}, getQueryStatusLabel(activeQuery))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
1302
|
-
style: {
|
|
1303
|
-
marginBottom: '.5em',
|
|
1304
|
-
display: 'flex',
|
|
1305
|
-
alignItems: 'center',
|
|
1306
|
-
justifyContent: 'space-between'
|
|
1307
|
-
}
|
|
1308
|
-
}, "Observers: ", /*#__PURE__*/React__namespace.createElement(Code, null, observerCount)), /*#__PURE__*/React__namespace.createElement("div", {
|
|
1309
|
-
style: {
|
|
1310
|
-
display: 'flex',
|
|
1311
|
-
alignItems: 'center',
|
|
1312
|
-
justifyContent: 'space-between'
|
|
1313
|
-
}
|
|
1314
|
-
}, "Last Updated:", ' ', /*#__PURE__*/React__namespace.createElement(Code, null, new Date(activeQueryState.dataUpdatedAt).toLocaleTimeString()))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
1315
|
-
style: {
|
|
1316
|
-
background: defaultTheme.backgroundAlt,
|
|
1317
|
-
padding: '.5em',
|
|
1318
|
-
position: 'sticky',
|
|
1319
|
-
top: 0,
|
|
1320
|
-
zIndex: 1
|
|
1321
|
-
}
|
|
1322
|
-
}, "Actions"), /*#__PURE__*/React__namespace.createElement("div", {
|
|
1323
|
-
style: {
|
|
1324
|
-
padding: '0.5em',
|
|
1325
|
-
display: 'flex',
|
|
1326
|
-
flexWrap: 'wrap',
|
|
1327
|
-
gap: '0.5em',
|
|
1328
|
-
alignItems: 'flex-end'
|
|
1329
|
-
}
|
|
1330
|
-
}, /*#__PURE__*/React__namespace.createElement(Button, {
|
|
1331
|
-
type: "button",
|
|
1332
|
-
onClick: handleRefetch,
|
|
1333
|
-
disabled: activeQueryState.fetchStatus === 'fetching',
|
|
1334
|
-
style: {
|
|
1335
|
-
background: defaultTheme.active
|
|
1336
|
-
}
|
|
1337
|
-
}, "Refetch"), ' ', /*#__PURE__*/React__namespace.createElement(Button, {
|
|
1338
|
-
type: "button",
|
|
1339
|
-
onClick: () => queryClient.invalidateQueries(activeQuery),
|
|
1340
|
-
style: {
|
|
1341
|
-
background: defaultTheme.warning,
|
|
1342
|
-
color: defaultTheme.inputTextColor
|
|
1343
|
-
}
|
|
1344
|
-
}, "Invalidate"), ' ', /*#__PURE__*/React__namespace.createElement(Button, {
|
|
1345
|
-
type: "button",
|
|
1346
|
-
onClick: () => queryClient.resetQueries(activeQuery),
|
|
1347
|
-
style: {
|
|
1348
|
-
background: defaultTheme.gray
|
|
1349
|
-
}
|
|
1350
|
-
}, "Reset"), ' ', /*#__PURE__*/React__namespace.createElement(Button, {
|
|
1351
|
-
type: "button",
|
|
1352
|
-
onClick: () => queryClient.removeQueries(activeQuery),
|
|
1353
|
-
style: {
|
|
1354
|
-
background: defaultTheme.danger
|
|
1355
|
-
}
|
|
1356
|
-
}, "Remove"), ' ', /*#__PURE__*/React__namespace.createElement(Button, {
|
|
1357
|
-
type: "button",
|
|
1358
|
-
onClick: () => {
|
|
1359
|
-
if (activeQuery.state.data === undefined) {
|
|
1360
|
-
restoreQueryAfterLoadingOrError();
|
|
1394
|
+
styleNonce,
|
|
1395
|
+
panelPosition: initialPanelPosition = 'bottom',
|
|
1396
|
+
errorTypes = []
|
|
1397
|
+
}) {
|
|
1398
|
+
const rootRef = React__namespace.useRef(null);
|
|
1399
|
+
const panelRef = React__namespace.useRef(null);
|
|
1400
|
+
const [isOpen, setIsOpen] = useLocalStorage('reactQueryDevtoolsOpen', initialIsOpen);
|
|
1401
|
+
const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage('reactQueryDevtoolsHeight', defaultPanelSize);
|
|
1402
|
+
const [devtoolsWidth, setDevtoolsWidth] = useLocalStorage('reactQueryDevtoolsWidth', defaultPanelSize);
|
|
1403
|
+
const [panelPosition = 'bottom', setPanelPosition] = useLocalStorage('reactQueryDevtoolsPanelPosition', initialPanelPosition);
|
|
1404
|
+
const [isResolvedOpen, setIsResolvedOpen] = React__namespace.useState(false);
|
|
1405
|
+
const [isResizing, setIsResizing] = React__namespace.useState(false);
|
|
1406
|
+
const isMounted = useIsMounted();
|
|
1407
|
+
const handleDragStart = (panelElement, startEvent) => {
|
|
1408
|
+
if (!panelElement) return;
|
|
1409
|
+
if (startEvent.button !== 0) return; // Only allow left click for drag
|
|
1410
|
+
const isVertical = isVerticalSide(panelPosition);
|
|
1411
|
+
setIsResizing(true);
|
|
1412
|
+
const {
|
|
1413
|
+
height,
|
|
1414
|
+
width
|
|
1415
|
+
} = panelElement.getBoundingClientRect();
|
|
1416
|
+
const startX = startEvent.clientX;
|
|
1417
|
+
const startY = startEvent.clientY;
|
|
1418
|
+
let newSize = 0;
|
|
1419
|
+
const run = moveEvent => {
|
|
1420
|
+
// prevent mouse selecting stuff with mouse drag
|
|
1421
|
+
moveEvent.preventDefault();
|
|
1422
|
+
|
|
1423
|
+
// calculate the correct size based on mouse position and current panel position
|
|
1424
|
+
// hint: it is different formula for the opposite sides
|
|
1425
|
+
if (isVertical) {
|
|
1426
|
+
newSize = width + (panelPosition === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX);
|
|
1427
|
+
setDevtoolsWidth(newSize);
|
|
1361
1428
|
} else {
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
activeQuery.fetch({
|
|
1365
|
-
...__previousQueryOptions,
|
|
1366
|
-
queryFn: () => {
|
|
1367
|
-
return new Promise(() => {
|
|
1368
|
-
// Never resolve
|
|
1369
|
-
});
|
|
1370
|
-
},
|
|
1371
|
-
gcTime: -1
|
|
1372
|
-
});
|
|
1373
|
-
activeQuery.setState({
|
|
1374
|
-
data: undefined,
|
|
1375
|
-
status: 'pending',
|
|
1376
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
1377
|
-
fetchMeta: {
|
|
1378
|
-
...activeQuery.state.fetchMeta,
|
|
1379
|
-
__previousQueryOptions
|
|
1380
|
-
}
|
|
1381
|
-
});
|
|
1429
|
+
newSize = height + (panelPosition === 'bottom' ? startY - moveEvent.clientY : moveEvent.clientY - startY);
|
|
1430
|
+
setDevtoolsHeight(newSize);
|
|
1382
1431
|
}
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
background: defaultTheme.paused
|
|
1386
|
-
}
|
|
1387
|
-
}, activeQuery.state.status === 'pending' ? 'Restore' : 'Trigger', ' ', "loading"), ' ', errorTypes.length === 0 || activeQuery.state.status === 'error' ? /*#__PURE__*/React__namespace.createElement(Button, {
|
|
1388
|
-
type: "button",
|
|
1389
|
-
onClick: () => {
|
|
1390
|
-
if (!activeQuery.state.error) {
|
|
1391
|
-
triggerError();
|
|
1432
|
+
if (newSize < minPanelSize) {
|
|
1433
|
+
setIsOpen(false);
|
|
1392
1434
|
} else {
|
|
1393
|
-
|
|
1435
|
+
setIsOpen(true);
|
|
1394
1436
|
}
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
},
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
})), /*#__PURE__*/React__namespace.createElement("div", {
|
|
1432
|
-
style: {
|
|
1433
|
-
background: defaultTheme.backgroundAlt,
|
|
1434
|
-
padding: '.5em',
|
|
1435
|
-
position: 'sticky',
|
|
1436
|
-
top: 0,
|
|
1437
|
-
zIndex: 1
|
|
1438
|
-
}
|
|
1439
|
-
}, "Query Explorer"), /*#__PURE__*/React__namespace.createElement("div", {
|
|
1440
|
-
style: {
|
|
1441
|
-
padding: '.5em'
|
|
1442
|
-
}
|
|
1443
|
-
}, /*#__PURE__*/React__namespace.createElement(Explorer, {
|
|
1444
|
-
label: "Query",
|
|
1445
|
-
value: activeQuery,
|
|
1446
|
-
defaultExpanded: {
|
|
1447
|
-
queryKey: true
|
|
1448
|
-
}
|
|
1449
|
-
})));
|
|
1450
|
-
};
|
|
1451
|
-
const QueryStatusCount = ({
|
|
1452
|
-
queryCache
|
|
1453
|
-
}) => {
|
|
1454
|
-
const hasFresh = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fresh').length);
|
|
1455
|
-
const hasFetching = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fetching').length);
|
|
1456
|
-
const hasPaused = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'paused').length);
|
|
1457
|
-
const hasStale = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'stale').length);
|
|
1458
|
-
const hasInactive = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'inactive').length);
|
|
1459
|
-
return /*#__PURE__*/React__namespace.createElement(QueryKeys, null, /*#__PURE__*/React__namespace.createElement(QueryKey, {
|
|
1460
|
-
style: {
|
|
1461
|
-
background: defaultTheme.success,
|
|
1462
|
-
opacity: hasFresh ? 1 : 0.3
|
|
1463
|
-
}
|
|
1464
|
-
}, "fresh ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasFresh, ")")), ' ', /*#__PURE__*/React__namespace.createElement(QueryKey, {
|
|
1465
|
-
style: {
|
|
1466
|
-
background: defaultTheme.active,
|
|
1467
|
-
opacity: hasFetching ? 1 : 0.3
|
|
1468
|
-
}
|
|
1469
|
-
}, "fetching ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasFetching, ")")), ' ', /*#__PURE__*/React__namespace.createElement(QueryKey, {
|
|
1470
|
-
style: {
|
|
1471
|
-
background: defaultTheme.paused,
|
|
1472
|
-
opacity: hasPaused ? 1 : 0.3
|
|
1473
|
-
}
|
|
1474
|
-
}, "paused ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasPaused, ")")), ' ', /*#__PURE__*/React__namespace.createElement(QueryKey, {
|
|
1475
|
-
style: {
|
|
1476
|
-
background: defaultTheme.warning,
|
|
1477
|
-
color: 'black',
|
|
1478
|
-
textShadow: '0',
|
|
1479
|
-
opacity: hasStale ? 1 : 0.3
|
|
1437
|
+
};
|
|
1438
|
+
const unsub = () => {
|
|
1439
|
+
if (isResizing) {
|
|
1440
|
+
setIsResizing(false);
|
|
1441
|
+
}
|
|
1442
|
+
document.removeEventListener('mousemove', run, false);
|
|
1443
|
+
document.removeEventListener('mouseUp', unsub, false);
|
|
1444
|
+
};
|
|
1445
|
+
document.addEventListener('mousemove', run, false);
|
|
1446
|
+
document.addEventListener('mouseup', unsub, false);
|
|
1447
|
+
};
|
|
1448
|
+
React__namespace.useEffect(() => {
|
|
1449
|
+
setIsResolvedOpen(isOpen != null ? isOpen : false);
|
|
1450
|
+
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
1451
|
+
|
|
1452
|
+
// Toggle panel visibility before/after transition (depending on direction).
|
|
1453
|
+
// Prevents focusing in a closed panel.
|
|
1454
|
+
React__namespace.useEffect(() => {
|
|
1455
|
+
const ref = panelRef.current;
|
|
1456
|
+
if (ref) {
|
|
1457
|
+
const handlePanelTransitionStart = () => {
|
|
1458
|
+
if (isResolvedOpen) {
|
|
1459
|
+
ref.style.visibility = 'visible';
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
const handlePanelTransitionEnd = () => {
|
|
1463
|
+
if (!isResolvedOpen) {
|
|
1464
|
+
ref.style.visibility = 'hidden';
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
ref.addEventListener('transitionstart', handlePanelTransitionStart);
|
|
1468
|
+
ref.addEventListener('transitionend', handlePanelTransitionEnd);
|
|
1469
|
+
return () => {
|
|
1470
|
+
ref.removeEventListener('transitionstart', handlePanelTransitionStart);
|
|
1471
|
+
ref.removeEventListener('transitionend', handlePanelTransitionEnd);
|
|
1472
|
+
};
|
|
1480
1473
|
}
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1474
|
+
return;
|
|
1475
|
+
}, [isResolvedOpen]);
|
|
1476
|
+
React__namespace.useEffect(() => {
|
|
1477
|
+
var _rootRef$current;
|
|
1478
|
+
if (isResolvedOpen && (_rootRef$current = rootRef.current) != null && _rootRef$current.parentElement) {
|
|
1479
|
+
const {
|
|
1480
|
+
parentElement
|
|
1481
|
+
} = rootRef.current;
|
|
1482
|
+
const styleProp = getSidedProp('padding', panelPosition);
|
|
1483
|
+
const isVertical = isVerticalSide(panelPosition);
|
|
1484
|
+
const previousPaddings = (({
|
|
1485
|
+
padding,
|
|
1486
|
+
paddingTop,
|
|
1487
|
+
paddingBottom,
|
|
1488
|
+
paddingLeft,
|
|
1489
|
+
paddingRight
|
|
1490
|
+
}) => ({
|
|
1491
|
+
padding,
|
|
1492
|
+
paddingTop,
|
|
1493
|
+
paddingBottom,
|
|
1494
|
+
paddingLeft,
|
|
1495
|
+
paddingRight
|
|
1496
|
+
}))(parentElement.style);
|
|
1497
|
+
const run = () => {
|
|
1498
|
+
// reset the padding
|
|
1499
|
+
parentElement.style.padding = '0px';
|
|
1500
|
+
parentElement.style.paddingTop = '0px';
|
|
1501
|
+
parentElement.style.paddingBottom = '0px';
|
|
1502
|
+
parentElement.style.paddingLeft = '0px';
|
|
1503
|
+
parentElement.style.paddingRight = '0px';
|
|
1504
|
+
// set the new padding based on the new panel position
|
|
1505
|
+
|
|
1506
|
+
parentElement.style[styleProp] = `${isVertical ? devtoolsWidth : devtoolsHeight}px`;
|
|
1507
|
+
};
|
|
1508
|
+
run();
|
|
1509
|
+
if (typeof window !== 'undefined') {
|
|
1510
|
+
window.addEventListener('resize', run);
|
|
1511
|
+
return () => {
|
|
1512
|
+
window.removeEventListener('resize', run);
|
|
1513
|
+
Object.entries(previousPaddings).forEach(([property, previousValue]) => {
|
|
1514
|
+
parentElement.style[property] = previousValue;
|
|
1515
|
+
});
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1485
1518
|
}
|
|
1486
|
-
|
|
1487
|
-
};
|
|
1488
|
-
const
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1519
|
+
return;
|
|
1520
|
+
}, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth]);
|
|
1521
|
+
const {
|
|
1522
|
+
style: panelStyle = {},
|
|
1523
|
+
...otherPanelProps
|
|
1524
|
+
} = panelProps;
|
|
1525
|
+
const {
|
|
1526
|
+
style: toggleButtonStyle = {},
|
|
1527
|
+
onClick: onToggleClick,
|
|
1528
|
+
...otherToggleButtonProps
|
|
1529
|
+
} = toggleButtonProps;
|
|
1530
|
+
|
|
1531
|
+
// get computed style based on panel position
|
|
1532
|
+
const style = getSidePanelStyle({
|
|
1533
|
+
position: panelPosition,
|
|
1534
|
+
devtoolsTheme: defaultTheme,
|
|
1535
|
+
isOpen: isResolvedOpen,
|
|
1536
|
+
height: devtoolsHeight,
|
|
1537
|
+
width: devtoolsWidth,
|
|
1538
|
+
isResizing,
|
|
1539
|
+
panelStyle
|
|
1506
1540
|
});
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1541
|
+
|
|
1542
|
+
// Do not render on the server
|
|
1543
|
+
if (!isMounted()) return null;
|
|
1544
|
+
return /*#__PURE__*/React__namespace.createElement(Container, {
|
|
1545
|
+
ref: rootRef,
|
|
1546
|
+
className: "ReactQueryDevtools",
|
|
1547
|
+
"aria-label": "React Query Devtools"
|
|
1548
|
+
}, /*#__PURE__*/React__namespace.createElement(ThemeProvider, {
|
|
1549
|
+
theme: defaultTheme
|
|
1550
|
+
}, /*#__PURE__*/React__namespace.createElement(ReactQueryDevtoolsPanel$2, _extends({
|
|
1551
|
+
ref: panelRef,
|
|
1552
|
+
queryClient: queryClient,
|
|
1553
|
+
styleNonce: styleNonce,
|
|
1554
|
+
position: panelPosition,
|
|
1555
|
+
onPositionChange: setPanelPosition,
|
|
1556
|
+
showCloseButton: true,
|
|
1557
|
+
closeButtonProps: closeButtonProps
|
|
1558
|
+
}, otherPanelProps, {
|
|
1559
|
+
style: style,
|
|
1560
|
+
isOpen: isResolvedOpen,
|
|
1561
|
+
setIsOpen: setIsOpen,
|
|
1562
|
+
onDragStart: e => handleDragStart(panelRef.current, e),
|
|
1563
|
+
errorTypes: errorTypes
|
|
1564
|
+
}))), !isResolvedOpen ? /*#__PURE__*/React__namespace.createElement("button", _extends({
|
|
1565
|
+
type: "button"
|
|
1566
|
+
}, otherToggleButtonProps, {
|
|
1567
|
+
"aria-label": "Open React Query Devtools",
|
|
1568
|
+
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
1569
|
+
"aria-haspopup": "true",
|
|
1570
|
+
"aria-expanded": "false",
|
|
1571
|
+
onClick: e => {
|
|
1572
|
+
setIsOpen(true);
|
|
1573
|
+
onToggleClick == null ? void 0 : onToggleClick(e);
|
|
1574
|
+
},
|
|
1532
1575
|
style: {
|
|
1533
|
-
|
|
1534
|
-
|
|
1576
|
+
background: 'none',
|
|
1577
|
+
border: 0,
|
|
1578
|
+
padding: 0,
|
|
1579
|
+
position: 'fixed',
|
|
1580
|
+
zIndex: 99999,
|
|
1581
|
+
display: 'inline-flex',
|
|
1582
|
+
fontSize: '1.5em',
|
|
1583
|
+
margin: '.5em',
|
|
1535
1584
|
cursor: 'pointer',
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1585
|
+
width: 'fit-content',
|
|
1586
|
+
...(position === 'top-right' ? {
|
|
1587
|
+
top: '0',
|
|
1588
|
+
right: '0'
|
|
1589
|
+
} : position === 'top-left' ? {
|
|
1590
|
+
top: '0',
|
|
1591
|
+
left: '0'
|
|
1592
|
+
} : position === 'bottom-right' ? {
|
|
1593
|
+
bottom: '0',
|
|
1594
|
+
right: '0'
|
|
1595
|
+
} : {
|
|
1596
|
+
bottom: '0',
|
|
1597
|
+
left: '0'
|
|
1548
1598
|
}),
|
|
1549
|
-
|
|
1550
|
-
alignItems: 'center',
|
|
1551
|
-
justifyContent: 'center',
|
|
1552
|
-
fontWeight: 'bold',
|
|
1553
|
-
textShadow: isStale ? '0' : '0 0 10px black',
|
|
1554
|
-
color: isStale ? 'black' : 'white'
|
|
1555
|
-
}
|
|
1556
|
-
}, observerCount), isDisabled ? /*#__PURE__*/React__namespace.createElement("div", {
|
|
1557
|
-
style: {
|
|
1558
|
-
flex: '0 0 auto',
|
|
1559
|
-
height: '2em',
|
|
1560
|
-
background: defaultTheme.gray,
|
|
1561
|
-
display: 'flex',
|
|
1562
|
-
alignItems: 'center',
|
|
1563
|
-
fontWeight: 'bold',
|
|
1564
|
-
padding: '0 0.5em'
|
|
1565
|
-
}
|
|
1566
|
-
}, "disabled") : null, /*#__PURE__*/React__namespace.createElement(Code, {
|
|
1567
|
-
style: {
|
|
1568
|
-
padding: '.5em'
|
|
1599
|
+
...toggleButtonStyle
|
|
1569
1600
|
}
|
|
1570
|
-
},
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1601
|
+
}), /*#__PURE__*/React__namespace.createElement(Logo, {
|
|
1602
|
+
"aria-hidden": true
|
|
1603
|
+
}), /*#__PURE__*/React__namespace.createElement(ScreenReader, {
|
|
1604
|
+
text: "Open React Query Devtools"
|
|
1605
|
+
})) : null);
|
|
1606
|
+
}
|
|
1575
1607
|
|
|
1576
1608
|
const ReactQueryDevtools = ReactQueryDevtools$1;
|
|
1577
|
-
const ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel$
|
|
1609
|
+
const ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel$2;
|
|
1578
1610
|
|
|
1579
1611
|
exports.ReactQueryDevtools = ReactQueryDevtools;
|
|
1580
1612
|
exports.ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel;
|