@tanstack/react-query-devtools 5.0.0-alpha.2 → 5.0.0-alpha.23
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 +310 -0
- package/build/lib/CachePanel/CachePanel.esm.js.map +1 -0
- package/build/lib/CachePanel/CachePanel.js +315 -0
- package/build/lib/CachePanel/CachePanel.js.map +1 -0
- package/build/lib/CachePanel/CachePanel.mjs +310 -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/Explorer.esm.js +2 -1
- package/build/lib/Explorer.esm.js.map +1 -1
- package/build/lib/Explorer.js +2 -1
- package/build/lib/Explorer.js.map +1 -1
- package/build/lib/Explorer.mjs +1 -0
- package/build/lib/Explorer.mjs.map +1 -1
- package/build/lib/devtools.d.ts +5 -48
- package/build/lib/devtools.esm.js +11 -550
- package/build/lib/devtools.esm.js.map +1 -1
- package/build/lib/devtools.js +12 -551
- package/build/lib/devtools.js.map +1 -1
- package/build/lib/devtools.mjs +7 -547
- package/build/lib/devtools.mjs.map +1 -1
- package/build/lib/index.esm.js +3 -1
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +3 -1
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +3 -1
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/index.prod.esm.js +821 -651
- package/build/lib/index.prod.esm.js.map +1 -1
- package/build/lib/index.prod.js +819 -650
- package/build/lib/index.prod.js.map +1 -1
- package/build/lib/index.prod.mjs +764 -625
- package/build/lib/index.prod.mjs.map +1 -1
- package/build/lib/styledComponents.d.ts +0 -1
- package/build/lib/styledComponents.esm.js +11 -1
- package/build/lib/styledComponents.esm.js.map +1 -1
- package/build/lib/styledComponents.js +11 -1
- package/build/lib/styledComponents.js.map +1 -1
- package/build/lib/styledComponents.mjs +11 -1
- package/build/lib/styledComponents.mjs.map +1 -1
- package/build/lib/theme.esm.js +1 -0
- package/build/lib/theme.esm.js.map +1 -1
- package/build/lib/theme.js +1 -0
- package/build/lib/theme.js.map +1 -1
- package/build/lib/theme.mjs +1 -0
- package/build/lib/theme.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 +1667 -1529
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +4 -4
- package/src/CachePanel/ActiveQuery.tsx +380 -0
- package/src/CachePanel/CachePanel.tsx +439 -0
- package/src/CachePanel/Header/QueryStatusCount.tsx +93 -0
- package/src/CachePanel/QueryRow.tsx +125 -0
- package/src/__tests__/Explorer.test.tsx +3 -2
- package/src/__tests__/devtools.test.tsx +229 -9
- package/src/devtools.tsx +10 -865
- package/src/styledComponents.ts +19 -1
- package/src/types.ts +12 -0
- package/src/useSubscribeToQueryCache.ts +26 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { rankItem } from '@tanstack/match-sorter-utils';
|
|
2
|
+
import React__default from 'react';
|
|
4
3
|
import SuperJSON from 'superjson';
|
|
4
|
+
import { notifyManager, useQueryClient, onlineManager } from '@tanstack/react-query';
|
|
5
|
+
import { rankItem } from '@tanstack/match-sorter-utils';
|
|
5
6
|
|
|
6
7
|
function _extends() {
|
|
7
8
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -290,6 +291,46 @@ function getResizeHandleStyle(position = 'bottom') {
|
|
|
290
291
|
};
|
|
291
292
|
}
|
|
292
293
|
|
|
294
|
+
function ScreenReader({
|
|
295
|
+
text
|
|
296
|
+
}) {
|
|
297
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
298
|
+
style: {
|
|
299
|
+
position: 'absolute',
|
|
300
|
+
width: '0.1px',
|
|
301
|
+
height: '0.1px',
|
|
302
|
+
overflow: 'hidden'
|
|
303
|
+
}
|
|
304
|
+
}, text);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function Logo(props) {
|
|
308
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
309
|
+
width: "40px",
|
|
310
|
+
height: "40px",
|
|
311
|
+
viewBox: "0 0 190 190",
|
|
312
|
+
version: "1.1"
|
|
313
|
+
}, props), /*#__PURE__*/React.createElement("g", {
|
|
314
|
+
stroke: "none",
|
|
315
|
+
strokeWidth: "1",
|
|
316
|
+
fill: "none",
|
|
317
|
+
fillRule: "evenodd"
|
|
318
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
319
|
+
transform: "translate(-33.000000, 0.000000)"
|
|
320
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
321
|
+
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",
|
|
322
|
+
fill: "#002C4B",
|
|
323
|
+
fillRule: "nonzero",
|
|
324
|
+
transform: "translate(128.000000, 95.000000) scale(-1, 1) translate(-128.000000, -95.000000) "
|
|
325
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
326
|
+
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",
|
|
327
|
+
fill: "#FFD94C"
|
|
328
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
329
|
+
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",
|
|
330
|
+
fill: "#FF4154"
|
|
331
|
+
}))));
|
|
332
|
+
}
|
|
333
|
+
|
|
293
334
|
const Panel = styled('div', (_props, theme) => ({
|
|
294
335
|
fontSize: 'clamp(12px, 1.5vw, 14px)',
|
|
295
336
|
fontFamily: `sans-serif`,
|
|
@@ -306,6 +347,7 @@ const Panel = styled('div', (_props, theme) => ({
|
|
|
306
347
|
}
|
|
307
348
|
});
|
|
308
349
|
|
|
350
|
+
Panel.displayName = 'Panel';
|
|
309
351
|
const ActiveQueryPanel = styled('div', () => ({
|
|
310
352
|
flex: '1 1 500px',
|
|
311
353
|
display: 'flex',
|
|
@@ -317,6 +359,7 @@ const ActiveQueryPanel = styled('div', () => ({
|
|
|
317
359
|
borderTop: `2px solid ${theme.gray}`
|
|
318
360
|
})
|
|
319
361
|
});
|
|
362
|
+
ActiveQueryPanel.displayName = 'ActiveQueryPanel';
|
|
320
363
|
const Button = styled('button', (props, theme) => ({
|
|
321
364
|
appearance: 'none',
|
|
322
365
|
fontSize: '.9em',
|
|
@@ -329,10 +372,14 @@ const Button = styled('button', (props, theme) => ({
|
|
|
329
372
|
opacity: props.disabled ? '.5' : undefined,
|
|
330
373
|
cursor: 'pointer'
|
|
331
374
|
}));
|
|
375
|
+
Button.displayName = 'Button';
|
|
332
376
|
const QueryKeys = styled('span', {
|
|
333
|
-
display: '
|
|
377
|
+
display: 'flex',
|
|
378
|
+
flexWrap: 'wrap',
|
|
379
|
+
gap: '0.5em',
|
|
334
380
|
fontSize: '0.9em'
|
|
335
381
|
});
|
|
382
|
+
QueryKeys.displayName = 'QueryKeys';
|
|
336
383
|
const QueryKey = styled('span', {
|
|
337
384
|
display: 'inline-flex',
|
|
338
385
|
alignItems: 'center',
|
|
@@ -341,11 +388,13 @@ const QueryKey = styled('span', {
|
|
|
341
388
|
textShadow: '0 0 10px black',
|
|
342
389
|
borderRadius: '.2em'
|
|
343
390
|
});
|
|
391
|
+
QueryKey.displayName = 'QueryKey';
|
|
344
392
|
const Code = styled('code', {
|
|
345
393
|
fontSize: '.9em',
|
|
346
394
|
color: 'inherit',
|
|
347
395
|
background: 'inherit'
|
|
348
396
|
});
|
|
397
|
+
Code.displayName = 'Code';
|
|
349
398
|
const Input = styled('input', (_props, theme) => ({
|
|
350
399
|
backgroundColor: theme.inputBackgroundColor,
|
|
351
400
|
border: 0,
|
|
@@ -355,6 +404,7 @@ const Input = styled('input', (_props, theme) => ({
|
|
|
355
404
|
lineHeight: `1.3`,
|
|
356
405
|
padding: '.3em .4em'
|
|
357
406
|
}));
|
|
407
|
+
Input.displayName = 'Input';
|
|
358
408
|
const Select = styled('select', (_props, theme) => ({
|
|
359
409
|
display: `inline-block`,
|
|
360
410
|
fontSize: `.9em`,
|
|
@@ -378,20 +428,149 @@ const Select = styled('select', (_props, theme) => ({
|
|
|
378
428
|
display: 'none'
|
|
379
429
|
}
|
|
380
430
|
});
|
|
431
|
+
Select.displayName = 'Select';
|
|
381
432
|
|
|
382
|
-
|
|
383
|
-
|
|
433
|
+
const useSubscribeToQueryCache = (queryCache, getSnapshot, skip = false) => {
|
|
434
|
+
return React__default.useSyncExternalStore(React__default.useCallback(onStoreChange => {
|
|
435
|
+
if (!skip) return queryCache.subscribe(notifyManager.batchCalls(onStoreChange));
|
|
436
|
+
return () => {
|
|
437
|
+
return;
|
|
438
|
+
};
|
|
439
|
+
}, [queryCache, skip]), getSnapshot, getSnapshot);
|
|
440
|
+
};
|
|
441
|
+
var useSubscribeToQueryCache$1 = useSubscribeToQueryCache;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Displays the number of queries for each status
|
|
445
|
+
*/
|
|
446
|
+
function QueryStatusCount({
|
|
447
|
+
queryCache
|
|
384
448
|
}) {
|
|
385
|
-
|
|
449
|
+
const hasFresh = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fresh').length);
|
|
450
|
+
const hasFetching = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fetching').length);
|
|
451
|
+
const hasPaused = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'paused').length);
|
|
452
|
+
const hasStale = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'stale').length);
|
|
453
|
+
const hasInactive = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'inactive').length);
|
|
454
|
+
return /*#__PURE__*/React__default.createElement(QueryKeys, null, /*#__PURE__*/React__default.createElement(QueryKey, {
|
|
386
455
|
style: {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
height: '0.1px',
|
|
390
|
-
overflow: 'hidden'
|
|
456
|
+
background: defaultTheme.success,
|
|
457
|
+
opacity: hasFresh ? 1 : 0.3
|
|
391
458
|
}
|
|
392
|
-
},
|
|
459
|
+
}, "fresh ", /*#__PURE__*/React__default.createElement(Code, null, "(", hasFresh, ")")), ' ', /*#__PURE__*/React__default.createElement(QueryKey, {
|
|
460
|
+
style: {
|
|
461
|
+
background: defaultTheme.active,
|
|
462
|
+
opacity: hasFetching ? 1 : 0.3
|
|
463
|
+
}
|
|
464
|
+
}, "fetching ", /*#__PURE__*/React__default.createElement(Code, null, "(", hasFetching, ")")), ' ', /*#__PURE__*/React__default.createElement(QueryKey, {
|
|
465
|
+
style: {
|
|
466
|
+
background: defaultTheme.paused,
|
|
467
|
+
opacity: hasPaused ? 1 : 0.3
|
|
468
|
+
}
|
|
469
|
+
}, "paused ", /*#__PURE__*/React__default.createElement(Code, null, "(", hasPaused, ")")), ' ', /*#__PURE__*/React__default.createElement(QueryKey, {
|
|
470
|
+
style: {
|
|
471
|
+
background: defaultTheme.warning,
|
|
472
|
+
color: 'black',
|
|
473
|
+
textShadow: '0',
|
|
474
|
+
opacity: hasStale ? 1 : 0.3
|
|
475
|
+
}
|
|
476
|
+
}, "stale ", /*#__PURE__*/React__default.createElement(Code, null, "(", hasStale, ")")), ' ', /*#__PURE__*/React__default.createElement(QueryKey, {
|
|
477
|
+
style: {
|
|
478
|
+
background: defaultTheme.gray,
|
|
479
|
+
opacity: hasInactive ? 1 : 0.3
|
|
480
|
+
}
|
|
481
|
+
}, "inactive ", /*#__PURE__*/React__default.createElement(Code, null, "(", hasInactive, ")")));
|
|
393
482
|
}
|
|
394
483
|
|
|
484
|
+
/**
|
|
485
|
+
* Row for a query in the query list
|
|
486
|
+
*/
|
|
487
|
+
const QueryRow = /*#__PURE__*/React__default.memo(({
|
|
488
|
+
queryKey,
|
|
489
|
+
setActiveQueryHash,
|
|
490
|
+
activeQueryHash,
|
|
491
|
+
queryCache
|
|
492
|
+
}) => {
|
|
493
|
+
var _useSubscribeToQueryC, _useSubscribeToQueryC2, _useSubscribeToQueryC3, _useSubscribeToQueryC4;
|
|
494
|
+
const queryHash = (_useSubscribeToQueryC = useSubscribeToQueryCache$1(queryCache, () => {
|
|
495
|
+
var _queryCache$find;
|
|
496
|
+
return (_queryCache$find = queryCache.find({
|
|
497
|
+
queryKey
|
|
498
|
+
})) == null ? void 0 : _queryCache$find.queryHash;
|
|
499
|
+
})) != null ? _useSubscribeToQueryC : '';
|
|
500
|
+
const queryState = useSubscribeToQueryCache$1(queryCache, () => {
|
|
501
|
+
var _queryCache$find2;
|
|
502
|
+
return (_queryCache$find2 = queryCache.find({
|
|
503
|
+
queryKey
|
|
504
|
+
})) == null ? void 0 : _queryCache$find2.state;
|
|
505
|
+
});
|
|
506
|
+
const isStale = (_useSubscribeToQueryC2 = useSubscribeToQueryCache$1(queryCache, () => {
|
|
507
|
+
var _queryCache$find3;
|
|
508
|
+
return (_queryCache$find3 = queryCache.find({
|
|
509
|
+
queryKey
|
|
510
|
+
})) == null ? void 0 : _queryCache$find3.isStale();
|
|
511
|
+
})) != null ? _useSubscribeToQueryC2 : false;
|
|
512
|
+
const isDisabled = (_useSubscribeToQueryC3 = useSubscribeToQueryCache$1(queryCache, () => {
|
|
513
|
+
var _queryCache$find4;
|
|
514
|
+
return (_queryCache$find4 = queryCache.find({
|
|
515
|
+
queryKey
|
|
516
|
+
})) == null ? void 0 : _queryCache$find4.isDisabled();
|
|
517
|
+
})) != null ? _useSubscribeToQueryC3 : false;
|
|
518
|
+
const observerCount = (_useSubscribeToQueryC4 = useSubscribeToQueryCache$1(queryCache, () => {
|
|
519
|
+
var _queryCache$find5;
|
|
520
|
+
return (_queryCache$find5 = queryCache.find({
|
|
521
|
+
queryKey
|
|
522
|
+
})) == null ? void 0 : _queryCache$find5.getObserversCount();
|
|
523
|
+
})) != null ? _useSubscribeToQueryC4 : 0;
|
|
524
|
+
if (!queryState) {
|
|
525
|
+
return null;
|
|
526
|
+
}
|
|
527
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
528
|
+
role: "button",
|
|
529
|
+
"aria-label": `Open query details for ${queryHash}`,
|
|
530
|
+
onClick: () => setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash),
|
|
531
|
+
style: {
|
|
532
|
+
display: 'flex',
|
|
533
|
+
borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
|
|
534
|
+
cursor: 'pointer',
|
|
535
|
+
background: queryHash === activeQueryHash ? 'rgba(255,255,255,.1)' : undefined
|
|
536
|
+
}
|
|
537
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
538
|
+
style: {
|
|
539
|
+
flex: '0 0 auto',
|
|
540
|
+
width: '2em',
|
|
541
|
+
height: '2em',
|
|
542
|
+
background: getQueryStatusColor({
|
|
543
|
+
queryState,
|
|
544
|
+
isStale,
|
|
545
|
+
observerCount,
|
|
546
|
+
theme: defaultTheme
|
|
547
|
+
}),
|
|
548
|
+
display: 'flex',
|
|
549
|
+
alignItems: 'center',
|
|
550
|
+
justifyContent: 'center',
|
|
551
|
+
fontWeight: 'bold',
|
|
552
|
+
textShadow: isStale ? '0' : '0 0 10px black',
|
|
553
|
+
color: isStale ? 'black' : 'white'
|
|
554
|
+
}
|
|
555
|
+
}, observerCount), isDisabled ? /*#__PURE__*/React__default.createElement("div", {
|
|
556
|
+
style: {
|
|
557
|
+
flex: '0 0 auto',
|
|
558
|
+
height: '2em',
|
|
559
|
+
background: defaultTheme.gray,
|
|
560
|
+
display: 'flex',
|
|
561
|
+
alignItems: 'center',
|
|
562
|
+
fontWeight: 'bold',
|
|
563
|
+
padding: '0 0.5em'
|
|
564
|
+
}
|
|
565
|
+
}, "disabled") : null, /*#__PURE__*/React__default.createElement(Code, {
|
|
566
|
+
style: {
|
|
567
|
+
padding: '.5em'
|
|
568
|
+
}
|
|
569
|
+
}, `${queryHash}`));
|
|
570
|
+
});
|
|
571
|
+
QueryRow.displayName = 'QueryRow';
|
|
572
|
+
var QueryRow$1 = QueryRow;
|
|
573
|
+
|
|
395
574
|
const Entry = styled('div', {
|
|
396
575
|
fontFamily: 'Menlo, monospace',
|
|
397
576
|
fontSize: '1em',
|
|
@@ -593,7 +772,7 @@ function Explorer({
|
|
|
593
772
|
const makeProperty = sub => {
|
|
594
773
|
const subDefaultExpanded = defaultExpanded === true ? {
|
|
595
774
|
[sub.label]: true
|
|
596
|
-
} : defaultExpanded
|
|
775
|
+
} : defaultExpanded == null ? void 0 : defaultExpanded[sub.label];
|
|
597
776
|
return {
|
|
598
777
|
...sub,
|
|
599
778
|
defaultExpanded: subDefaultExpanded
|
|
@@ -638,419 +817,430 @@ function Explorer({
|
|
|
638
817
|
});
|
|
639
818
|
}
|
|
640
819
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
width: "40px",
|
|
644
|
-
height: "40px",
|
|
645
|
-
viewBox: "0 0 190 190",
|
|
646
|
-
version: "1.1"
|
|
647
|
-
}, props), /*#__PURE__*/React.createElement("g", {
|
|
648
|
-
stroke: "none",
|
|
649
|
-
strokeWidth: "1",
|
|
650
|
-
fill: "none",
|
|
651
|
-
fillRule: "evenodd"
|
|
652
|
-
}, /*#__PURE__*/React.createElement("g", {
|
|
653
|
-
transform: "translate(-33.000000, 0.000000)"
|
|
654
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
655
|
-
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",
|
|
656
|
-
fill: "#002C4B",
|
|
657
|
-
fillRule: "nonzero",
|
|
658
|
-
transform: "translate(128.000000, 95.000000) scale(-1, 1) translate(-128.000000, -95.000000) "
|
|
659
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
660
|
-
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",
|
|
661
|
-
fill: "#FFD94C"
|
|
662
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
663
|
-
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",
|
|
664
|
-
fill: "#FF4154"
|
|
665
|
-
}))));
|
|
666
|
-
}
|
|
820
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
821
|
+
function noop() {}
|
|
667
822
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
823
|
+
/**
|
|
824
|
+
* Panel for the query currently being inspected
|
|
825
|
+
*
|
|
826
|
+
* It displays query details (key, observers...), query actions,
|
|
827
|
+
* the data explorer and the query explorer
|
|
828
|
+
*/
|
|
829
|
+
const ActiveQuery = ({
|
|
830
|
+
queryCache,
|
|
831
|
+
activeQueryHash,
|
|
675
832
|
queryClient,
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
const
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
const
|
|
694
|
-
|
|
695
|
-
width
|
|
696
|
-
} = panelElement.getBoundingClientRect();
|
|
697
|
-
const startX = startEvent.clientX;
|
|
698
|
-
const startY = startEvent.clientY;
|
|
699
|
-
let newSize = 0;
|
|
700
|
-
const run = moveEvent => {
|
|
701
|
-
// prevent mouse selecting stuff with mouse drag
|
|
702
|
-
moveEvent.preventDefault();
|
|
703
|
-
|
|
704
|
-
// calculate the correct size based on mouse position and current panel position
|
|
705
|
-
// hint: it is different formula for the opposite sides
|
|
706
|
-
if (isVertical) {
|
|
707
|
-
newSize = width + (panelPosition === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX);
|
|
708
|
-
setDevtoolsWidth(newSize);
|
|
709
|
-
} else {
|
|
710
|
-
newSize = height + (panelPosition === 'bottom' ? startY - moveEvent.clientY : moveEvent.clientY - startY);
|
|
711
|
-
setDevtoolsHeight(newSize);
|
|
712
|
-
}
|
|
713
|
-
if (newSize < minPanelSize) {
|
|
714
|
-
setIsOpen(false);
|
|
715
|
-
} else {
|
|
716
|
-
setIsOpen(true);
|
|
717
|
-
}
|
|
718
|
-
};
|
|
719
|
-
const unsub = () => {
|
|
720
|
-
if (isResizing) {
|
|
721
|
-
setIsResizing(false);
|
|
722
|
-
}
|
|
723
|
-
document.removeEventListener('mousemove', run, false);
|
|
724
|
-
document.removeEventListener('mouseUp', unsub, false);
|
|
725
|
-
};
|
|
726
|
-
document.addEventListener('mousemove', run, false);
|
|
727
|
-
document.addEventListener('mouseup', unsub, false);
|
|
833
|
+
errorTypes
|
|
834
|
+
}) => {
|
|
835
|
+
var _useSubscribeToQueryC, _useSubscribeToQueryC2;
|
|
836
|
+
const activeQuery = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash));
|
|
837
|
+
const activeQueryState = useSubscribeToQueryCache$1(queryCache, () => {
|
|
838
|
+
var _queryCache$getAll$fi;
|
|
839
|
+
return (_queryCache$getAll$fi = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi.state;
|
|
840
|
+
});
|
|
841
|
+
const isStale = (_useSubscribeToQueryC = useSubscribeToQueryCache$1(queryCache, () => {
|
|
842
|
+
var _queryCache$getAll$fi2;
|
|
843
|
+
return (_queryCache$getAll$fi2 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi2.isStale();
|
|
844
|
+
})) != null ? _useSubscribeToQueryC : false;
|
|
845
|
+
const observerCount = (_useSubscribeToQueryC2 = useSubscribeToQueryCache$1(queryCache, () => {
|
|
846
|
+
var _queryCache$getAll$fi3;
|
|
847
|
+
return (_queryCache$getAll$fi3 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi3.getObserversCount();
|
|
848
|
+
})) != null ? _useSubscribeToQueryC2 : 0;
|
|
849
|
+
const handleRefetch = () => {
|
|
850
|
+
const promise = activeQuery == null ? void 0 : activeQuery.fetch();
|
|
851
|
+
promise == null ? void 0 : promise.catch(noop);
|
|
728
852
|
};
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
const ref = panelRef.current;
|
|
737
|
-
if (ref) {
|
|
738
|
-
const handlePanelTransitionStart = () => {
|
|
739
|
-
if (isResolvedOpen) {
|
|
740
|
-
ref.style.visibility = 'visible';
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
const handlePanelTransitionEnd = () => {
|
|
744
|
-
if (!isResolvedOpen) {
|
|
745
|
-
ref.style.visibility = 'hidden';
|
|
746
|
-
}
|
|
747
|
-
};
|
|
748
|
-
ref.addEventListener('transitionstart', handlePanelTransitionStart);
|
|
749
|
-
ref.addEventListener('transitionend', handlePanelTransitionEnd);
|
|
750
|
-
return () => {
|
|
751
|
-
ref.removeEventListener('transitionstart', handlePanelTransitionStart);
|
|
752
|
-
ref.removeEventListener('transitionend', handlePanelTransitionEnd);
|
|
753
|
-
};
|
|
853
|
+
const currentErrorTypeName = React__default.useMemo(() => {
|
|
854
|
+
if (activeQuery && activeQueryState != null && activeQueryState.error) {
|
|
855
|
+
const errorType = errorTypes.find(type => {
|
|
856
|
+
var _activeQueryState$err;
|
|
857
|
+
return type.initializer(activeQuery).toString() === ((_activeQueryState$err = activeQueryState.error) == null ? void 0 : _activeQueryState$err.toString());
|
|
858
|
+
});
|
|
859
|
+
return errorType == null ? void 0 : errorType.name;
|
|
754
860
|
}
|
|
755
|
-
return;
|
|
756
|
-
}, [
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
padding,
|
|
772
|
-
paddingTop,
|
|
773
|
-
paddingBottom,
|
|
774
|
-
paddingLeft,
|
|
775
|
-
paddingRight
|
|
776
|
-
}))(parentElement.style);
|
|
777
|
-
const run = () => {
|
|
778
|
-
// reset the padding
|
|
779
|
-
parentElement.style.padding = '0px';
|
|
780
|
-
parentElement.style.paddingTop = '0px';
|
|
781
|
-
parentElement.style.paddingBottom = '0px';
|
|
782
|
-
parentElement.style.paddingLeft = '0px';
|
|
783
|
-
parentElement.style.paddingRight = '0px';
|
|
784
|
-
// set the new padding based on the new panel position
|
|
785
|
-
|
|
786
|
-
parentElement.style[styleProp] = `${isVertical ? devtoolsWidth : devtoolsHeight}px`;
|
|
787
|
-
};
|
|
788
|
-
run();
|
|
789
|
-
if (typeof window !== 'undefined') {
|
|
790
|
-
window.addEventListener('resize', run);
|
|
791
|
-
return () => {
|
|
792
|
-
window.removeEventListener('resize', run);
|
|
793
|
-
Object.entries(previousPaddings).forEach(([property, previousValue]) => {
|
|
794
|
-
parentElement.style[property] = previousValue;
|
|
795
|
-
});
|
|
796
|
-
};
|
|
861
|
+
return undefined;
|
|
862
|
+
}, [activeQuery, activeQueryState == null ? void 0 : activeQueryState.error, errorTypes]);
|
|
863
|
+
if (!activeQuery || !activeQueryState) {
|
|
864
|
+
return null;
|
|
865
|
+
}
|
|
866
|
+
const triggerError = errorType => {
|
|
867
|
+
var _errorType$initialize;
|
|
868
|
+
const error = (_errorType$initialize = errorType == null ? void 0 : errorType.initializer(activeQuery)) != null ? _errorType$initialize : new Error('Unknown error from devtools');
|
|
869
|
+
const __previousQueryOptions = activeQuery.options;
|
|
870
|
+
activeQuery.setState({
|
|
871
|
+
status: 'error',
|
|
872
|
+
error,
|
|
873
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
874
|
+
fetchMeta: {
|
|
875
|
+
...activeQuery.state.fetchMeta,
|
|
876
|
+
__previousQueryOptions
|
|
797
877
|
}
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
onClick: onToggleClick,
|
|
808
|
-
...otherToggleButtonProps
|
|
809
|
-
} = toggleButtonProps;
|
|
810
|
-
|
|
811
|
-
// get computed style based on panel position
|
|
812
|
-
const style = getSidePanelStyle({
|
|
813
|
-
position: panelPosition,
|
|
814
|
-
devtoolsTheme: defaultTheme,
|
|
815
|
-
isOpen: isResolvedOpen,
|
|
816
|
-
height: devtoolsHeight,
|
|
817
|
-
width: devtoolsWidth,
|
|
818
|
-
isResizing,
|
|
819
|
-
panelStyle
|
|
820
|
-
});
|
|
821
|
-
|
|
822
|
-
// Do not render on the server
|
|
823
|
-
if (!isMounted()) return null;
|
|
824
|
-
return /*#__PURE__*/React.createElement(Container, {
|
|
825
|
-
ref: rootRef,
|
|
826
|
-
className: "ReactQueryDevtools",
|
|
827
|
-
"aria-label": "React Query Devtools"
|
|
828
|
-
}, /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
829
|
-
theme: defaultTheme
|
|
830
|
-
}, /*#__PURE__*/React.createElement(ReactQueryDevtoolsPanel$1, _extends({
|
|
831
|
-
ref: panelRef,
|
|
832
|
-
queryClient: queryClient,
|
|
833
|
-
styleNonce: styleNonce,
|
|
834
|
-
position: panelPosition,
|
|
835
|
-
onPositionChange: setPanelPosition,
|
|
836
|
-
showCloseButton: true,
|
|
837
|
-
closeButtonProps: closeButtonProps
|
|
838
|
-
}, otherPanelProps, {
|
|
839
|
-
style: style,
|
|
840
|
-
isOpen: isResolvedOpen,
|
|
841
|
-
setIsOpen: setIsOpen,
|
|
842
|
-
onDragStart: e => handleDragStart(panelRef.current, e)
|
|
843
|
-
}))), !isResolvedOpen ? /*#__PURE__*/React.createElement("button", _extends({
|
|
844
|
-
type: "button"
|
|
845
|
-
}, otherToggleButtonProps, {
|
|
846
|
-
"aria-label": "Open React Query Devtools",
|
|
847
|
-
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
848
|
-
"aria-haspopup": "true",
|
|
849
|
-
"aria-expanded": "false",
|
|
850
|
-
onClick: e => {
|
|
851
|
-
setIsOpen(true);
|
|
852
|
-
onToggleClick?.(e);
|
|
853
|
-
},
|
|
878
|
+
});
|
|
879
|
+
};
|
|
880
|
+
const restoreQueryAfterLoadingOrError = () => {
|
|
881
|
+
activeQuery.fetch(activeQuery.state.fetchMeta.__previousQueryOptions, {
|
|
882
|
+
// Make sure this fetch will cancel the previous one
|
|
883
|
+
cancelRefetch: true
|
|
884
|
+
});
|
|
885
|
+
};
|
|
886
|
+
return /*#__PURE__*/React__default.createElement(ActiveQueryPanel, null, /*#__PURE__*/React__default.createElement("div", {
|
|
854
887
|
style: {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
zIndex:
|
|
860
|
-
display: 'inline-flex',
|
|
861
|
-
fontSize: '1.5em',
|
|
862
|
-
margin: '.5em',
|
|
863
|
-
cursor: 'pointer',
|
|
864
|
-
width: 'fit-content',
|
|
865
|
-
...(position === 'top-right' ? {
|
|
866
|
-
top: '0',
|
|
867
|
-
right: '0'
|
|
868
|
-
} : position === 'top-left' ? {
|
|
869
|
-
top: '0',
|
|
870
|
-
left: '0'
|
|
871
|
-
} : position === 'bottom-right' ? {
|
|
872
|
-
bottom: '0',
|
|
873
|
-
right: '0'
|
|
874
|
-
} : {
|
|
875
|
-
bottom: '0',
|
|
876
|
-
left: '0'
|
|
877
|
-
}),
|
|
878
|
-
...toggleButtonStyle
|
|
879
|
-
}
|
|
880
|
-
}), /*#__PURE__*/React.createElement(Logo, {
|
|
881
|
-
"aria-hidden": true
|
|
882
|
-
}), /*#__PURE__*/React.createElement(ScreenReader, {
|
|
883
|
-
text: "Open React Query Devtools"
|
|
884
|
-
})) : null);
|
|
885
|
-
}
|
|
886
|
-
const useSubscribeToQueryCache = (queryCache, getSnapshot, skip = false) => {
|
|
887
|
-
return React.useSyncExternalStore(React.useCallback(onStoreChange => {
|
|
888
|
-
if (!skip) return queryCache.subscribe(notifyManager.batchCalls(onStoreChange));
|
|
889
|
-
return () => {
|
|
890
|
-
return;
|
|
891
|
-
};
|
|
892
|
-
}, [queryCache, skip]), getSnapshot, getSnapshot);
|
|
893
|
-
};
|
|
894
|
-
const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
|
|
895
|
-
const {
|
|
896
|
-
isOpen = true,
|
|
897
|
-
styleNonce,
|
|
898
|
-
setIsOpen,
|
|
899
|
-
queryClient,
|
|
900
|
-
onDragStart,
|
|
901
|
-
onPositionChange,
|
|
902
|
-
showCloseButton,
|
|
903
|
-
position,
|
|
904
|
-
closeButtonProps = {},
|
|
905
|
-
...panelProps
|
|
906
|
-
} = props;
|
|
907
|
-
const {
|
|
908
|
-
onClick: onCloseClick,
|
|
909
|
-
...otherCloseButtonProps
|
|
910
|
-
} = closeButtonProps;
|
|
911
|
-
const client = useQueryClient(queryClient);
|
|
912
|
-
const queryCache = client.getQueryCache();
|
|
913
|
-
const [sort, setSort] = useLocalStorage('reactQueryDevtoolsSortFn', Object.keys(sortFns)[0]);
|
|
914
|
-
const [filter, setFilter] = useLocalStorage('reactQueryDevtoolsFilter', '');
|
|
915
|
-
const [baseSort, setBaseSort] = useLocalStorage('reactQueryDevtoolsBaseSort', 1);
|
|
916
|
-
const sortFn = React.useMemo(() => sortFns[sort], [sort]);
|
|
917
|
-
const queriesCount = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().length, !isOpen);
|
|
918
|
-
const [activeQueryHash, setActiveQueryHash] = useLocalStorage('reactQueryDevtoolsActiveQueryHash', '');
|
|
919
|
-
const queries = React.useMemo(() => {
|
|
920
|
-
const unsortedQueries = queryCache.getAll();
|
|
921
|
-
if (queriesCount === 0) {
|
|
922
|
-
return [];
|
|
888
|
+
padding: '.5em',
|
|
889
|
+
background: defaultTheme.backgroundAlt,
|
|
890
|
+
position: 'sticky',
|
|
891
|
+
top: 0,
|
|
892
|
+
zIndex: 1
|
|
923
893
|
}
|
|
924
|
-
|
|
925
|
-
const sorted = sortFn ? filtered.sort((a, b) => sortFn(a, b) * baseSort) : filtered;
|
|
926
|
-
return sorted;
|
|
927
|
-
}, [baseSort, sortFn, filter, queriesCount, queryCache]);
|
|
928
|
-
const [isMockOffline, setMockOffline] = React.useState(false);
|
|
929
|
-
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
930
|
-
theme: defaultTheme
|
|
931
|
-
}, /*#__PURE__*/React.createElement(Panel, _extends({
|
|
932
|
-
ref: ref,
|
|
933
|
-
className: "ReactQueryDevtoolsPanel",
|
|
934
|
-
"aria-label": "React Query Devtools Panel",
|
|
935
|
-
id: "ReactQueryDevtoolsPanel"
|
|
936
|
-
}, panelProps, {
|
|
894
|
+
}, "Query Details"), /*#__PURE__*/React__default.createElement("div", {
|
|
937
895
|
style: {
|
|
938
|
-
|
|
939
|
-
position: 'relative',
|
|
940
|
-
...panelProps.style
|
|
941
|
-
}
|
|
942
|
-
}), /*#__PURE__*/React.createElement("style", {
|
|
943
|
-
nonce: styleNonce,
|
|
944
|
-
dangerouslySetInnerHTML: {
|
|
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
|
-
`
|
|
896
|
+
padding: '.5em'
|
|
965
897
|
}
|
|
966
|
-
}
|
|
967
|
-
style: getResizeHandleStyle(position),
|
|
968
|
-
onMouseDown: onDragStart
|
|
969
|
-
}), isOpen && /*#__PURE__*/React.createElement("div", {
|
|
898
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
970
899
|
style: {
|
|
971
|
-
|
|
972
|
-
minHeight: '40%',
|
|
973
|
-
maxHeight: '100%',
|
|
974
|
-
overflow: 'auto',
|
|
975
|
-
borderRight: `1px solid ${defaultTheme.grayAlt}`,
|
|
900
|
+
marginBottom: '.5em',
|
|
976
901
|
display: 'flex',
|
|
977
|
-
|
|
902
|
+
alignItems: 'flex-start',
|
|
903
|
+
justifyContent: 'space-between'
|
|
978
904
|
}
|
|
979
|
-
}, /*#__PURE__*/
|
|
905
|
+
}, /*#__PURE__*/React__default.createElement(Code, {
|
|
980
906
|
style: {
|
|
981
|
-
|
|
982
|
-
background: defaultTheme.backgroundAlt,
|
|
983
|
-
display: 'flex',
|
|
984
|
-
justifyContent: 'space-between',
|
|
985
|
-
alignItems: 'center'
|
|
907
|
+
lineHeight: '1.8em'
|
|
986
908
|
}
|
|
987
|
-
}, /*#__PURE__*/
|
|
988
|
-
type: "button",
|
|
989
|
-
"aria-label": "Close React Query Devtools",
|
|
990
|
-
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
991
|
-
"aria-haspopup": "true",
|
|
992
|
-
"aria-expanded": "true",
|
|
993
|
-
onClick: () => setIsOpen(false),
|
|
909
|
+
}, /*#__PURE__*/React__default.createElement("pre", {
|
|
994
910
|
style: {
|
|
995
|
-
|
|
996
|
-
background: 'none',
|
|
997
|
-
border: 0,
|
|
911
|
+
margin: 0,
|
|
998
912
|
padding: 0,
|
|
999
|
-
|
|
1000
|
-
cursor: 'pointer'
|
|
913
|
+
overflow: 'auto'
|
|
1001
914
|
}
|
|
1002
|
-
}, /*#__PURE__*/
|
|
1003
|
-
"aria-hidden": true
|
|
1004
|
-
}), /*#__PURE__*/React.createElement(ScreenReader, {
|
|
1005
|
-
text: "Close React Query Devtools"
|
|
1006
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
915
|
+
}, displayValue(activeQuery.queryKey, true))), /*#__PURE__*/React__default.createElement("span", {
|
|
1007
916
|
style: {
|
|
1008
|
-
|
|
1009
|
-
|
|
917
|
+
padding: '0.3em .6em',
|
|
918
|
+
borderRadius: '0.4em',
|
|
919
|
+
fontWeight: 'bold',
|
|
920
|
+
textShadow: '0 2px 10px black',
|
|
921
|
+
background: getQueryStatusColor({
|
|
922
|
+
queryState: activeQueryState,
|
|
923
|
+
isStale: isStale,
|
|
924
|
+
observerCount: observerCount,
|
|
925
|
+
theme: defaultTheme
|
|
926
|
+
}),
|
|
927
|
+
flexShrink: 0
|
|
1010
928
|
}
|
|
1011
|
-
}, /*#__PURE__*/
|
|
929
|
+
}, getQueryStatusLabel(activeQuery))), /*#__PURE__*/React__default.createElement("div", {
|
|
1012
930
|
style: {
|
|
931
|
+
marginBottom: '.5em',
|
|
1013
932
|
display: 'flex',
|
|
1014
|
-
justifyContent: 'space-between',
|
|
1015
933
|
alignItems: 'center',
|
|
1016
|
-
|
|
934
|
+
justifyContent: 'space-between'
|
|
1017
935
|
}
|
|
1018
|
-
}, /*#__PURE__*/
|
|
1019
|
-
|
|
1020
|
-
|
|
936
|
+
}, "Observers: ", /*#__PURE__*/React__default.createElement(Code, null, observerCount)), /*#__PURE__*/React__default.createElement("div", {
|
|
937
|
+
style: {
|
|
938
|
+
display: 'flex',
|
|
939
|
+
alignItems: 'center',
|
|
940
|
+
justifyContent: 'space-between'
|
|
941
|
+
}
|
|
942
|
+
}, "Last Updated:", ' ', /*#__PURE__*/React__default.createElement(Code, null, new Date(activeQueryState.dataUpdatedAt).toLocaleTimeString()))), /*#__PURE__*/React__default.createElement("div", {
|
|
943
|
+
style: {
|
|
944
|
+
background: defaultTheme.backgroundAlt,
|
|
945
|
+
padding: '.5em',
|
|
946
|
+
position: 'sticky',
|
|
947
|
+
top: 0,
|
|
948
|
+
zIndex: 1
|
|
949
|
+
}
|
|
950
|
+
}, "Actions"), /*#__PURE__*/React__default.createElement("div", {
|
|
951
|
+
style: {
|
|
952
|
+
padding: '0.5em',
|
|
953
|
+
display: 'flex',
|
|
954
|
+
flexWrap: 'wrap',
|
|
955
|
+
gap: '0.5em',
|
|
956
|
+
alignItems: 'flex-end'
|
|
957
|
+
}
|
|
958
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
959
|
+
type: "button",
|
|
960
|
+
onClick: handleRefetch,
|
|
961
|
+
disabled: activeQueryState.fetchStatus === 'fetching',
|
|
962
|
+
style: {
|
|
963
|
+
background: defaultTheme.active
|
|
964
|
+
}
|
|
965
|
+
}, "Refetch"), ' ', /*#__PURE__*/React__default.createElement(Button, {
|
|
966
|
+
type: "button",
|
|
967
|
+
onClick: () => queryClient.invalidateQueries(activeQuery),
|
|
968
|
+
style: {
|
|
969
|
+
background: defaultTheme.warning,
|
|
970
|
+
color: defaultTheme.inputTextColor
|
|
971
|
+
}
|
|
972
|
+
}, "Invalidate"), ' ', /*#__PURE__*/React__default.createElement(Button, {
|
|
973
|
+
type: "button",
|
|
974
|
+
onClick: () => queryClient.resetQueries(activeQuery),
|
|
975
|
+
style: {
|
|
976
|
+
background: defaultTheme.gray
|
|
977
|
+
}
|
|
978
|
+
}, "Reset"), ' ', /*#__PURE__*/React__default.createElement(Button, {
|
|
979
|
+
type: "button",
|
|
980
|
+
onClick: () => queryClient.removeQueries(activeQuery),
|
|
981
|
+
style: {
|
|
982
|
+
background: defaultTheme.danger
|
|
983
|
+
}
|
|
984
|
+
}, "Remove"), ' ', /*#__PURE__*/React__default.createElement(Button, {
|
|
985
|
+
type: "button",
|
|
986
|
+
onClick: () => {
|
|
987
|
+
if (activeQuery.state.data === undefined) {
|
|
988
|
+
restoreQueryAfterLoadingOrError();
|
|
989
|
+
} else {
|
|
990
|
+
const __previousQueryOptions = activeQuery.options;
|
|
991
|
+
// Trigger a fetch in order to trigger suspense as well.
|
|
992
|
+
activeQuery.fetch({
|
|
993
|
+
...__previousQueryOptions,
|
|
994
|
+
queryFn: () => {
|
|
995
|
+
return new Promise(() => {
|
|
996
|
+
// Never resolve
|
|
997
|
+
});
|
|
998
|
+
},
|
|
999
|
+
gcTime: -1
|
|
1000
|
+
});
|
|
1001
|
+
activeQuery.setState({
|
|
1002
|
+
data: undefined,
|
|
1003
|
+
status: 'pending',
|
|
1004
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
1005
|
+
fetchMeta: {
|
|
1006
|
+
...activeQuery.state.fetchMeta,
|
|
1007
|
+
__previousQueryOptions
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
},
|
|
1012
|
+
style: {
|
|
1013
|
+
background: defaultTheme.paused
|
|
1014
|
+
}
|
|
1015
|
+
}, activeQuery.state.status === 'pending' ? 'Restore' : 'Trigger', ' ', "loading"), ' ', errorTypes.length === 0 || activeQuery.state.status === 'error' ? /*#__PURE__*/React__default.createElement(Button, {
|
|
1016
|
+
type: "button",
|
|
1017
|
+
onClick: () => {
|
|
1018
|
+
if (!activeQuery.state.error) {
|
|
1019
|
+
triggerError();
|
|
1020
|
+
} else {
|
|
1021
|
+
queryClient.resetQueries(activeQuery);
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
style: {
|
|
1025
|
+
background: defaultTheme.danger
|
|
1026
|
+
}
|
|
1027
|
+
}, activeQuery.state.status === 'error' ? 'Restore' : 'Trigger', " error") : /*#__PURE__*/React__default.createElement("label", null, "Trigger error:", /*#__PURE__*/React__default.createElement(Select, {
|
|
1028
|
+
value: currentErrorTypeName != null ? currentErrorTypeName : '',
|
|
1029
|
+
style: {
|
|
1030
|
+
marginInlineStart: '.5em'
|
|
1031
|
+
},
|
|
1032
|
+
onChange: e => {
|
|
1033
|
+
const errorType = errorTypes.find(t => t.name === e.target.value);
|
|
1034
|
+
triggerError(errorType);
|
|
1035
|
+
}
|
|
1036
|
+
}, /*#__PURE__*/React__default.createElement("option", {
|
|
1037
|
+
key: "",
|
|
1038
|
+
value: ""
|
|
1039
|
+
}), errorTypes.map(errorType => /*#__PURE__*/React__default.createElement("option", {
|
|
1040
|
+
key: errorType.name,
|
|
1041
|
+
value: errorType.name
|
|
1042
|
+
}, errorType.name))))), /*#__PURE__*/React__default.createElement("div", {
|
|
1043
|
+
style: {
|
|
1044
|
+
background: defaultTheme.backgroundAlt,
|
|
1045
|
+
padding: '.5em',
|
|
1046
|
+
position: 'sticky',
|
|
1047
|
+
top: 0,
|
|
1048
|
+
zIndex: 1
|
|
1049
|
+
}
|
|
1050
|
+
}, "Data Explorer"), /*#__PURE__*/React__default.createElement("div", {
|
|
1051
|
+
style: {
|
|
1052
|
+
padding: '.5em'
|
|
1053
|
+
}
|
|
1054
|
+
}, /*#__PURE__*/React__default.createElement(Explorer, {
|
|
1055
|
+
label: "Data",
|
|
1056
|
+
value: activeQueryState.data,
|
|
1057
|
+
defaultExpanded: {},
|
|
1058
|
+
copyable: true
|
|
1059
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
1060
|
+
style: {
|
|
1061
|
+
background: defaultTheme.backgroundAlt,
|
|
1062
|
+
padding: '.5em',
|
|
1063
|
+
position: 'sticky',
|
|
1064
|
+
top: 0,
|
|
1065
|
+
zIndex: 1
|
|
1066
|
+
}
|
|
1067
|
+
}, "Query Explorer"), /*#__PURE__*/React__default.createElement("div", {
|
|
1068
|
+
style: {
|
|
1069
|
+
padding: '.5em'
|
|
1070
|
+
}
|
|
1071
|
+
}, /*#__PURE__*/React__default.createElement(Explorer, {
|
|
1072
|
+
label: "Query",
|
|
1073
|
+
value: activeQuery,
|
|
1074
|
+
defaultExpanded: {
|
|
1075
|
+
queryKey: true
|
|
1076
|
+
}
|
|
1077
|
+
})));
|
|
1078
|
+
};
|
|
1079
|
+
ActiveQuery.displayName = 'ActiveQuery';
|
|
1080
|
+
var ActiveQuery$1 = ActiveQuery;
|
|
1081
|
+
|
|
1082
|
+
const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__default.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
|
|
1083
|
+
const {
|
|
1084
|
+
isOpen = true,
|
|
1085
|
+
styleNonce,
|
|
1086
|
+
setIsOpen,
|
|
1087
|
+
queryClient,
|
|
1088
|
+
onDragStart,
|
|
1089
|
+
onPositionChange,
|
|
1090
|
+
showCloseButton,
|
|
1091
|
+
position,
|
|
1092
|
+
closeButtonProps = {},
|
|
1093
|
+
errorTypes = [],
|
|
1094
|
+
...panelProps
|
|
1095
|
+
} = props;
|
|
1096
|
+
const {
|
|
1097
|
+
onClick: onCloseClick,
|
|
1098
|
+
...otherCloseButtonProps
|
|
1099
|
+
} = closeButtonProps;
|
|
1100
|
+
const client = useQueryClient(queryClient);
|
|
1101
|
+
const queryCache = client.getQueryCache();
|
|
1102
|
+
const [sort, setSort] = useLocalStorage('reactQueryDevtoolsSortFn', Object.keys(sortFns)[0]);
|
|
1103
|
+
const [filter, setFilter] = useLocalStorage('reactQueryDevtoolsFilter', '');
|
|
1104
|
+
const [baseSort, setBaseSort] = useLocalStorage('reactQueryDevtoolsBaseSort', 1);
|
|
1105
|
+
const sortFn = React__default.useMemo(() => sortFns[sort], [sort]);
|
|
1106
|
+
const queriesCount = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().length, !isOpen);
|
|
1107
|
+
const [activeQueryHash, setActiveQueryHash] = useLocalStorage('reactQueryDevtoolsActiveQueryHash', '');
|
|
1108
|
+
const queries = React__default.useMemo(() => {
|
|
1109
|
+
const unsortedQueries = queryCache.getAll();
|
|
1110
|
+
if (queriesCount === 0) {
|
|
1111
|
+
return [];
|
|
1112
|
+
}
|
|
1113
|
+
const filtered = filter ? unsortedQueries.filter(item => rankItem(item.queryHash, filter).passed) : [...unsortedQueries];
|
|
1114
|
+
const sorted = sortFn ? filtered.sort((a, b) => sortFn(a, b) * baseSort) : filtered;
|
|
1115
|
+
return sorted;
|
|
1116
|
+
}, [baseSort, sortFn, filter, queriesCount, queryCache]);
|
|
1117
|
+
const [isMockOffline, setMockOffline] = React__default.useState(false);
|
|
1118
|
+
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
1119
|
+
theme: defaultTheme
|
|
1120
|
+
}, /*#__PURE__*/React__default.createElement(Panel, _extends({
|
|
1121
|
+
ref: ref,
|
|
1122
|
+
className: "ReactQueryDevtoolsPanel",
|
|
1123
|
+
"aria-label": "React Query Devtools Panel",
|
|
1124
|
+
id: "ReactQueryDevtoolsPanel"
|
|
1125
|
+
}, panelProps, {
|
|
1126
|
+
style: {
|
|
1127
|
+
height: defaultPanelSize,
|
|
1128
|
+
position: 'relative',
|
|
1129
|
+
...panelProps.style
|
|
1130
|
+
}
|
|
1131
|
+
}), /*#__PURE__*/React__default.createElement("style", {
|
|
1132
|
+
nonce: styleNonce,
|
|
1133
|
+
dangerouslySetInnerHTML: {
|
|
1134
|
+
__html: `
|
|
1135
|
+
.ReactQueryDevtoolsPanel * {
|
|
1136
|
+
scrollbar-color: ${defaultTheme.backgroundAlt} ${defaultTheme.gray};
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar, .ReactQueryDevtoolsPanel scrollbar {
|
|
1140
|
+
width: 1em;
|
|
1141
|
+
height: 1em;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar-track, .ReactQueryDevtoolsPanel scrollbar-track {
|
|
1145
|
+
background: ${defaultTheme.backgroundAlt};
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar-thumb, .ReactQueryDevtoolsPanel scrollbar-thumb {
|
|
1149
|
+
background: ${defaultTheme.gray};
|
|
1150
|
+
border-radius: .5em;
|
|
1151
|
+
border: 3px solid ${defaultTheme.backgroundAlt};
|
|
1152
|
+
}
|
|
1153
|
+
`
|
|
1154
|
+
}
|
|
1155
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1156
|
+
style: getResizeHandleStyle(position),
|
|
1157
|
+
onMouseDown: onDragStart
|
|
1158
|
+
}), isOpen && /*#__PURE__*/React__default.createElement("div", {
|
|
1159
|
+
style: {
|
|
1160
|
+
flex: '1 1 500px',
|
|
1161
|
+
minHeight: '40%',
|
|
1162
|
+
maxHeight: '100%',
|
|
1163
|
+
overflow: 'auto',
|
|
1164
|
+
borderRight: `1px solid ${defaultTheme.grayAlt}`,
|
|
1165
|
+
display: 'flex',
|
|
1166
|
+
flexDirection: 'column'
|
|
1167
|
+
}
|
|
1168
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1169
|
+
style: {
|
|
1170
|
+
padding: '.5em',
|
|
1171
|
+
background: defaultTheme.backgroundAlt,
|
|
1172
|
+
display: 'flex',
|
|
1173
|
+
justifyContent: 'space-between',
|
|
1174
|
+
alignItems: 'center'
|
|
1175
|
+
}
|
|
1176
|
+
}, /*#__PURE__*/React__default.createElement("button", {
|
|
1177
|
+
type: "button",
|
|
1178
|
+
"aria-label": "Close React Query Devtools",
|
|
1179
|
+
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
1180
|
+
"aria-haspopup": "true",
|
|
1181
|
+
"aria-expanded": "true",
|
|
1182
|
+
onClick: () => setIsOpen(false),
|
|
1183
|
+
style: {
|
|
1184
|
+
display: 'inline-flex',
|
|
1185
|
+
background: 'none',
|
|
1186
|
+
border: 0,
|
|
1187
|
+
padding: 0,
|
|
1188
|
+
marginRight: '.5em',
|
|
1189
|
+
cursor: 'pointer'
|
|
1190
|
+
}
|
|
1191
|
+
}, /*#__PURE__*/React__default.createElement(Logo, {
|
|
1192
|
+
"aria-hidden": true
|
|
1193
|
+
}), /*#__PURE__*/React__default.createElement(ScreenReader, {
|
|
1194
|
+
text: "Close React Query Devtools"
|
|
1195
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
1196
|
+
style: {
|
|
1197
|
+
display: 'flex',
|
|
1198
|
+
flexDirection: 'column'
|
|
1199
|
+
}
|
|
1200
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1201
|
+
style: {
|
|
1202
|
+
display: 'flex',
|
|
1203
|
+
justifyContent: 'space-between',
|
|
1204
|
+
alignItems: 'center',
|
|
1205
|
+
marginBottom: '.5em'
|
|
1206
|
+
}
|
|
1207
|
+
}, /*#__PURE__*/React__default.createElement(QueryStatusCount, {
|
|
1208
|
+
queryCache: queryCache
|
|
1209
|
+
}), position && onPositionChange ? /*#__PURE__*/React__default.createElement(Select, {
|
|
1021
1210
|
"aria-label": "Panel position",
|
|
1022
1211
|
value: position,
|
|
1023
1212
|
style: {
|
|
1024
1213
|
marginInlineStart: '.5em'
|
|
1025
1214
|
},
|
|
1026
1215
|
onChange: e => onPositionChange(e.target.value)
|
|
1027
|
-
}, /*#__PURE__*/
|
|
1216
|
+
}, /*#__PURE__*/React__default.createElement("option", {
|
|
1028
1217
|
value: "left"
|
|
1029
|
-
}, "Left"), /*#__PURE__*/
|
|
1218
|
+
}, "Left"), /*#__PURE__*/React__default.createElement("option", {
|
|
1030
1219
|
value: "right"
|
|
1031
|
-
}, "Right"), /*#__PURE__*/
|
|
1220
|
+
}, "Right"), /*#__PURE__*/React__default.createElement("option", {
|
|
1032
1221
|
value: "top"
|
|
1033
|
-
}, "Top"), /*#__PURE__*/
|
|
1222
|
+
}, "Top"), /*#__PURE__*/React__default.createElement("option", {
|
|
1034
1223
|
value: "bottom"
|
|
1035
|
-
}, "Bottom")) : null), /*#__PURE__*/
|
|
1224
|
+
}, "Bottom")) : null), /*#__PURE__*/React__default.createElement("div", {
|
|
1036
1225
|
style: {
|
|
1037
1226
|
display: 'flex',
|
|
1038
|
-
alignItems: 'center'
|
|
1227
|
+
alignItems: 'center',
|
|
1228
|
+
flexWrap: 'wrap',
|
|
1229
|
+
gap: '0.5em'
|
|
1039
1230
|
}
|
|
1040
|
-
}, /*#__PURE__*/
|
|
1231
|
+
}, /*#__PURE__*/React__default.createElement(Input, {
|
|
1041
1232
|
placeholder: "Filter",
|
|
1042
1233
|
"aria-label": "Filter by queryhash",
|
|
1043
|
-
value: filter
|
|
1234
|
+
value: filter != null ? filter : '',
|
|
1044
1235
|
onChange: e => setFilter(e.target.value),
|
|
1045
1236
|
onKeyDown: e => {
|
|
1046
1237
|
if (e.key === 'Escape') setFilter('');
|
|
1047
1238
|
},
|
|
1048
1239
|
style: {
|
|
1049
1240
|
flex: '1',
|
|
1050
|
-
marginRight: '.5em',
|
|
1051
1241
|
width: '100%'
|
|
1052
1242
|
}
|
|
1053
|
-
}), /*#__PURE__*/
|
|
1243
|
+
}), /*#__PURE__*/React__default.createElement(Select, {
|
|
1054
1244
|
"aria-label": "Sort queries",
|
|
1055
1245
|
value: sort,
|
|
1056
1246
|
onChange: e => setSort(e.target.value),
|
|
@@ -1059,17 +1249,26 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1059
1249
|
minWidth: 75,
|
|
1060
1250
|
marginRight: '.5em'
|
|
1061
1251
|
}
|
|
1062
|
-
}, Object.keys(sortFns).map(key => /*#__PURE__*/
|
|
1252
|
+
}, Object.keys(sortFns).map(key => /*#__PURE__*/React__default.createElement("option", {
|
|
1063
1253
|
key: key,
|
|
1064
1254
|
value: key
|
|
1065
|
-
}, "Sort by ", key))), /*#__PURE__*/
|
|
1255
|
+
}, "Sort by ", key))), /*#__PURE__*/React__default.createElement(Button, {
|
|
1066
1256
|
type: "button",
|
|
1067
1257
|
onClick: () => setBaseSort(old => old * -1),
|
|
1068
1258
|
style: {
|
|
1069
1259
|
padding: '.3em .4em',
|
|
1070
1260
|
marginRight: '.5em'
|
|
1071
1261
|
}
|
|
1072
|
-
}, baseSort === 1 ? '⬆ Asc' : '⬇ Desc'), /*#__PURE__*/
|
|
1262
|
+
}, baseSort === 1 ? '⬆ Asc' : '⬇ Desc'), /*#__PURE__*/React__default.createElement(Button, {
|
|
1263
|
+
title: "Clear cache",
|
|
1264
|
+
"aria-label": "Clear cache",
|
|
1265
|
+
type: "button",
|
|
1266
|
+
onClick: () => queryCache.clear(),
|
|
1267
|
+
style: {
|
|
1268
|
+
padding: '.3em .4em',
|
|
1269
|
+
marginRight: '.5em'
|
|
1270
|
+
}
|
|
1271
|
+
}, "Clear"), /*#__PURE__*/React__default.createElement(Button, {
|
|
1073
1272
|
type: "button",
|
|
1074
1273
|
onClick: () => {
|
|
1075
1274
|
if (isMockOffline) {
|
|
@@ -1079,6 +1278,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1079
1278
|
} else {
|
|
1080
1279
|
onlineManager.setOnline(false);
|
|
1081
1280
|
setMockOffline(true);
|
|
1281
|
+
window.dispatchEvent(new Event('offline'));
|
|
1082
1282
|
}
|
|
1083
1283
|
},
|
|
1084
1284
|
"aria-label": isMockOffline ? 'Restore offline mock' : 'Mock offline behavior',
|
|
@@ -1087,68 +1287,69 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1087
1287
|
padding: '0',
|
|
1088
1288
|
height: '2em'
|
|
1089
1289
|
}
|
|
1090
|
-
}, /*#__PURE__*/
|
|
1290
|
+
}, /*#__PURE__*/React__default.createElement("svg", {
|
|
1091
1291
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1092
1292
|
width: "2em",
|
|
1093
1293
|
height: "2em",
|
|
1094
1294
|
viewBox: "0 0 24 24",
|
|
1095
1295
|
stroke: isMockOffline ? defaultTheme.danger : 'currentColor',
|
|
1096
1296
|
fill: "none"
|
|
1097
|
-
}, isMockOffline ? /*#__PURE__*/
|
|
1297
|
+
}, isMockOffline ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("path", {
|
|
1098
1298
|
stroke: "none",
|
|
1099
1299
|
d: "M0 0h24v24H0z",
|
|
1100
1300
|
fill: "none"
|
|
1101
|
-
}), /*#__PURE__*/
|
|
1301
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
1102
1302
|
x1: "12",
|
|
1103
1303
|
y1: "18",
|
|
1104
1304
|
x2: "12.01",
|
|
1105
1305
|
y2: "18"
|
|
1106
|
-
}), /*#__PURE__*/
|
|
1306
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1107
1307
|
d: "M9.172 15.172a4 4 0 0 1 5.656 0"
|
|
1108
|
-
}), /*#__PURE__*/
|
|
1308
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1109
1309
|
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"
|
|
1110
|
-
}), /*#__PURE__*/
|
|
1310
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1111
1311
|
d: "M3.515 9.515a12 12 0 0 1 3.544 -2.455m3.101 -.92a12 12 0 0 1 10.325 3.374"
|
|
1112
|
-
}), /*#__PURE__*/
|
|
1312
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
1113
1313
|
x1: "3",
|
|
1114
1314
|
y1: "3",
|
|
1115
1315
|
x2: "21",
|
|
1116
1316
|
y2: "21"
|
|
1117
|
-
})) : /*#__PURE__*/
|
|
1317
|
+
})) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("path", {
|
|
1118
1318
|
stroke: "none",
|
|
1119
1319
|
d: "M0 0h24v24H0z",
|
|
1120
1320
|
fill: "none"
|
|
1121
|
-
}), /*#__PURE__*/
|
|
1321
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
1122
1322
|
x1: "12",
|
|
1123
1323
|
y1: "18",
|
|
1124
1324
|
x2: "12.01",
|
|
1125
1325
|
y2: "18"
|
|
1126
|
-
}), /*#__PURE__*/
|
|
1326
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1127
1327
|
d: "M9.172 15.172a4 4 0 0 1 5.656 0"
|
|
1128
|
-
}), /*#__PURE__*/
|
|
1328
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1129
1329
|
d: "M6.343 12.343a8 8 0 0 1 11.314 0"
|
|
1130
|
-
}), /*#__PURE__*/
|
|
1330
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1131
1331
|
d: "M3.515 9.515c4.686 -4.687 12.284 -4.687 17 0"
|
|
1132
|
-
}))), /*#__PURE__*/
|
|
1332
|
+
}))), /*#__PURE__*/React__default.createElement(ScreenReader, {
|
|
1133
1333
|
text: isMockOffline ? 'Restore offline mock' : 'Mock offline behavior'
|
|
1134
|
-
}))))), /*#__PURE__*/
|
|
1334
|
+
}))))), /*#__PURE__*/React__default.createElement("div", {
|
|
1135
1335
|
style: {
|
|
1136
1336
|
overflowY: 'auto',
|
|
1137
1337
|
flex: '1'
|
|
1138
1338
|
}
|
|
1139
1339
|
}, queries.map(query => {
|
|
1140
|
-
return /*#__PURE__*/
|
|
1340
|
+
return /*#__PURE__*/React__default.createElement(QueryRow$1, {
|
|
1141
1341
|
queryKey: query.queryKey,
|
|
1142
1342
|
activeQueryHash: activeQueryHash,
|
|
1143
1343
|
setActiveQueryHash: setActiveQueryHash,
|
|
1144
1344
|
key: query.queryHash,
|
|
1145
1345
|
queryCache: queryCache
|
|
1146
1346
|
});
|
|
1147
|
-
}))), activeQueryHash && isOpen ? /*#__PURE__*/
|
|
1347
|
+
}))), activeQueryHash && isOpen ? /*#__PURE__*/React__default.createElement(ActiveQuery$1, {
|
|
1148
1348
|
activeQueryHash: activeQueryHash,
|
|
1149
1349
|
queryCache: queryCache,
|
|
1150
|
-
queryClient: client
|
|
1151
|
-
|
|
1350
|
+
queryClient: client,
|
|
1351
|
+
errorTypes: errorTypes
|
|
1352
|
+
}) : null, showCloseButton ? /*#__PURE__*/React__default.createElement(Button, _extends({
|
|
1152
1353
|
type: "button",
|
|
1153
1354
|
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
1154
1355
|
"aria-haspopup": "true",
|
|
@@ -1164,268 +1365,237 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1164
1365
|
},
|
|
1165
1366
|
onClick: e => {
|
|
1166
1367
|
setIsOpen(false);
|
|
1167
|
-
onCloseClick
|
|
1368
|
+
onCloseClick == null ? void 0 : onCloseClick(e);
|
|
1168
1369
|
}
|
|
1169
1370
|
}), "Close") : null));
|
|
1170
1371
|
});
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
}
|
|
1262
|
-
}, "Refetch"), ' ', /*#__PURE__*/React.createElement(Button, {
|
|
1263
|
-
type: "button",
|
|
1264
|
-
onClick: () => queryClient.invalidateQueries(activeQuery),
|
|
1265
|
-
style: {
|
|
1266
|
-
background: defaultTheme.warning,
|
|
1267
|
-
color: defaultTheme.inputTextColor
|
|
1268
|
-
}
|
|
1269
|
-
}, "Invalidate"), ' ', /*#__PURE__*/React.createElement(Button, {
|
|
1270
|
-
type: "button",
|
|
1271
|
-
onClick: () => queryClient.resetQueries(activeQuery),
|
|
1272
|
-
style: {
|
|
1273
|
-
background: defaultTheme.gray
|
|
1274
|
-
}
|
|
1275
|
-
}, "Reset"), ' ', /*#__PURE__*/React.createElement(Button, {
|
|
1276
|
-
type: "button",
|
|
1277
|
-
onClick: () => queryClient.removeQueries(activeQuery),
|
|
1278
|
-
style: {
|
|
1279
|
-
background: defaultTheme.danger
|
|
1280
|
-
}
|
|
1281
|
-
}, "Remove")), /*#__PURE__*/React.createElement("div", {
|
|
1282
|
-
style: {
|
|
1283
|
-
background: defaultTheme.backgroundAlt,
|
|
1284
|
-
padding: '.5em',
|
|
1285
|
-
position: 'sticky',
|
|
1286
|
-
top: 0,
|
|
1287
|
-
zIndex: 1
|
|
1288
|
-
}
|
|
1289
|
-
}, "Data Explorer"), /*#__PURE__*/React.createElement("div", {
|
|
1290
|
-
style: {
|
|
1291
|
-
padding: '.5em'
|
|
1292
|
-
}
|
|
1293
|
-
}, /*#__PURE__*/React.createElement(Explorer, {
|
|
1294
|
-
label: "Data",
|
|
1295
|
-
value: activeQueryState.data,
|
|
1296
|
-
defaultExpanded: {},
|
|
1297
|
-
copyable: true
|
|
1298
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
1299
|
-
style: {
|
|
1300
|
-
background: defaultTheme.backgroundAlt,
|
|
1301
|
-
padding: '.5em',
|
|
1302
|
-
position: 'sticky',
|
|
1303
|
-
top: 0,
|
|
1304
|
-
zIndex: 1
|
|
1305
|
-
}
|
|
1306
|
-
}, "Query Explorer"), /*#__PURE__*/React.createElement("div", {
|
|
1307
|
-
style: {
|
|
1308
|
-
padding: '.5em'
|
|
1309
|
-
}
|
|
1310
|
-
}, /*#__PURE__*/React.createElement(Explorer, {
|
|
1311
|
-
label: "Query",
|
|
1312
|
-
value: activeQuery,
|
|
1313
|
-
defaultExpanded: {
|
|
1314
|
-
queryKey: true
|
|
1315
|
-
}
|
|
1316
|
-
})));
|
|
1317
|
-
};
|
|
1318
|
-
const QueryStatusCount = ({
|
|
1319
|
-
queryCache
|
|
1320
|
-
}) => {
|
|
1321
|
-
const hasFresh = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fresh').length);
|
|
1322
|
-
const hasFetching = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fetching').length);
|
|
1323
|
-
const hasPaused = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'paused').length);
|
|
1324
|
-
const hasStale = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'stale').length);
|
|
1325
|
-
const hasInactive = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'inactive').length);
|
|
1326
|
-
return /*#__PURE__*/React.createElement(QueryKeys, null, /*#__PURE__*/React.createElement(QueryKey, {
|
|
1327
|
-
style: {
|
|
1328
|
-
background: defaultTheme.success,
|
|
1329
|
-
opacity: hasFresh ? 1 : 0.3
|
|
1330
|
-
}
|
|
1331
|
-
}, "fresh ", /*#__PURE__*/React.createElement(Code, null, "(", hasFresh, ")")), ' ', /*#__PURE__*/React.createElement(QueryKey, {
|
|
1332
|
-
style: {
|
|
1333
|
-
background: defaultTheme.active,
|
|
1334
|
-
opacity: hasFetching ? 1 : 0.3
|
|
1335
|
-
}
|
|
1336
|
-
}, "fetching ", /*#__PURE__*/React.createElement(Code, null, "(", hasFetching, ")")), ' ', /*#__PURE__*/React.createElement(QueryKey, {
|
|
1337
|
-
style: {
|
|
1338
|
-
background: defaultTheme.paused,
|
|
1339
|
-
opacity: hasPaused ? 1 : 0.3
|
|
1340
|
-
}
|
|
1341
|
-
}, "paused ", /*#__PURE__*/React.createElement(Code, null, "(", hasPaused, ")")), ' ', /*#__PURE__*/React.createElement(QueryKey, {
|
|
1342
|
-
style: {
|
|
1343
|
-
background: defaultTheme.warning,
|
|
1344
|
-
color: 'black',
|
|
1345
|
-
textShadow: '0',
|
|
1346
|
-
opacity: hasStale ? 1 : 0.3
|
|
1372
|
+
ReactQueryDevtoolsPanel$1.displayName = 'ReactQueryDevtoolsPanel';
|
|
1373
|
+
var ReactQueryDevtoolsPanel$2 = ReactQueryDevtoolsPanel$1;
|
|
1374
|
+
|
|
1375
|
+
function ReactQueryDevtools$1({
|
|
1376
|
+
initialIsOpen,
|
|
1377
|
+
panelProps = {},
|
|
1378
|
+
closeButtonProps = {},
|
|
1379
|
+
toggleButtonProps = {},
|
|
1380
|
+
position = 'bottom-left',
|
|
1381
|
+
containerElement: Container = 'aside',
|
|
1382
|
+
queryClient,
|
|
1383
|
+
styleNonce,
|
|
1384
|
+
panelPosition: initialPanelPosition = 'bottom',
|
|
1385
|
+
errorTypes = []
|
|
1386
|
+
}) {
|
|
1387
|
+
const rootRef = React.useRef(null);
|
|
1388
|
+
const panelRef = React.useRef(null);
|
|
1389
|
+
const [isOpen, setIsOpen] = useLocalStorage('reactQueryDevtoolsOpen', initialIsOpen);
|
|
1390
|
+
const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage('reactQueryDevtoolsHeight', defaultPanelSize);
|
|
1391
|
+
const [devtoolsWidth, setDevtoolsWidth] = useLocalStorage('reactQueryDevtoolsWidth', defaultPanelSize);
|
|
1392
|
+
const [panelPosition = 'bottom', setPanelPosition] = useLocalStorage('reactQueryDevtoolsPanelPosition', initialPanelPosition);
|
|
1393
|
+
const [isResolvedOpen, setIsResolvedOpen] = React.useState(false);
|
|
1394
|
+
const [isResizing, setIsResizing] = React.useState(false);
|
|
1395
|
+
const isMounted = useIsMounted();
|
|
1396
|
+
const handleDragStart = (panelElement, startEvent) => {
|
|
1397
|
+
if (!panelElement) return;
|
|
1398
|
+
if (startEvent.button !== 0) return; // Only allow left click for drag
|
|
1399
|
+
const isVertical = isVerticalSide(panelPosition);
|
|
1400
|
+
setIsResizing(true);
|
|
1401
|
+
const {
|
|
1402
|
+
height,
|
|
1403
|
+
width
|
|
1404
|
+
} = panelElement.getBoundingClientRect();
|
|
1405
|
+
const startX = startEvent.clientX;
|
|
1406
|
+
const startY = startEvent.clientY;
|
|
1407
|
+
let newSize = 0;
|
|
1408
|
+
const run = moveEvent => {
|
|
1409
|
+
// prevent mouse selecting stuff with mouse drag
|
|
1410
|
+
moveEvent.preventDefault();
|
|
1411
|
+
|
|
1412
|
+
// calculate the correct size based on mouse position and current panel position
|
|
1413
|
+
// hint: it is different formula for the opposite sides
|
|
1414
|
+
if (isVertical) {
|
|
1415
|
+
newSize = width + (panelPosition === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX);
|
|
1416
|
+
setDevtoolsWidth(newSize);
|
|
1417
|
+
} else {
|
|
1418
|
+
newSize = height + (panelPosition === 'bottom' ? startY - moveEvent.clientY : moveEvent.clientY - startY);
|
|
1419
|
+
setDevtoolsHeight(newSize);
|
|
1420
|
+
}
|
|
1421
|
+
if (newSize < minPanelSize) {
|
|
1422
|
+
setIsOpen(false);
|
|
1423
|
+
} else {
|
|
1424
|
+
setIsOpen(true);
|
|
1425
|
+
}
|
|
1426
|
+
};
|
|
1427
|
+
const unsub = () => {
|
|
1428
|
+
if (isResizing) {
|
|
1429
|
+
setIsResizing(false);
|
|
1430
|
+
}
|
|
1431
|
+
document.removeEventListener('mousemove', run, false);
|
|
1432
|
+
document.removeEventListener('mouseUp', unsub, false);
|
|
1433
|
+
};
|
|
1434
|
+
document.addEventListener('mousemove', run, false);
|
|
1435
|
+
document.addEventListener('mouseup', unsub, false);
|
|
1436
|
+
};
|
|
1437
|
+
React.useEffect(() => {
|
|
1438
|
+
setIsResolvedOpen(isOpen != null ? isOpen : false);
|
|
1439
|
+
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
1440
|
+
|
|
1441
|
+
// Toggle panel visibility before/after transition (depending on direction).
|
|
1442
|
+
// Prevents focusing in a closed panel.
|
|
1443
|
+
React.useEffect(() => {
|
|
1444
|
+
const ref = panelRef.current;
|
|
1445
|
+
if (ref) {
|
|
1446
|
+
const handlePanelTransitionStart = () => {
|
|
1447
|
+
if (isResolvedOpen) {
|
|
1448
|
+
ref.style.visibility = 'visible';
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
const handlePanelTransitionEnd = () => {
|
|
1452
|
+
if (!isResolvedOpen) {
|
|
1453
|
+
ref.style.visibility = 'hidden';
|
|
1454
|
+
}
|
|
1455
|
+
};
|
|
1456
|
+
ref.addEventListener('transitionstart', handlePanelTransitionStart);
|
|
1457
|
+
ref.addEventListener('transitionend', handlePanelTransitionEnd);
|
|
1458
|
+
return () => {
|
|
1459
|
+
ref.removeEventListener('transitionstart', handlePanelTransitionStart);
|
|
1460
|
+
ref.removeEventListener('transitionend', handlePanelTransitionEnd);
|
|
1461
|
+
};
|
|
1347
1462
|
}
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1463
|
+
return;
|
|
1464
|
+
}, [isResolvedOpen]);
|
|
1465
|
+
React.useEffect(() => {
|
|
1466
|
+
var _rootRef$current;
|
|
1467
|
+
if (isResolvedOpen && (_rootRef$current = rootRef.current) != null && _rootRef$current.parentElement) {
|
|
1468
|
+
const {
|
|
1469
|
+
parentElement
|
|
1470
|
+
} = rootRef.current;
|
|
1471
|
+
const styleProp = getSidedProp('padding', panelPosition);
|
|
1472
|
+
const isVertical = isVerticalSide(panelPosition);
|
|
1473
|
+
const previousPaddings = (({
|
|
1474
|
+
padding,
|
|
1475
|
+
paddingTop,
|
|
1476
|
+
paddingBottom,
|
|
1477
|
+
paddingLeft,
|
|
1478
|
+
paddingRight
|
|
1479
|
+
}) => ({
|
|
1480
|
+
padding,
|
|
1481
|
+
paddingTop,
|
|
1482
|
+
paddingBottom,
|
|
1483
|
+
paddingLeft,
|
|
1484
|
+
paddingRight
|
|
1485
|
+
}))(parentElement.style);
|
|
1486
|
+
const run = () => {
|
|
1487
|
+
// reset the padding
|
|
1488
|
+
parentElement.style.padding = '0px';
|
|
1489
|
+
parentElement.style.paddingTop = '0px';
|
|
1490
|
+
parentElement.style.paddingBottom = '0px';
|
|
1491
|
+
parentElement.style.paddingLeft = '0px';
|
|
1492
|
+
parentElement.style.paddingRight = '0px';
|
|
1493
|
+
// set the new padding based on the new panel position
|
|
1494
|
+
|
|
1495
|
+
parentElement.style[styleProp] = `${isVertical ? devtoolsWidth : devtoolsHeight}px`;
|
|
1496
|
+
};
|
|
1497
|
+
run();
|
|
1498
|
+
if (typeof window !== 'undefined') {
|
|
1499
|
+
window.addEventListener('resize', run);
|
|
1500
|
+
return () => {
|
|
1501
|
+
window.removeEventListener('resize', run);
|
|
1502
|
+
Object.entries(previousPaddings).forEach(([property, previousValue]) => {
|
|
1503
|
+
parentElement.style[property] = previousValue;
|
|
1504
|
+
});
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1352
1507
|
}
|
|
1353
|
-
|
|
1354
|
-
};
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
"aria-label":
|
|
1382
|
-
|
|
1508
|
+
return;
|
|
1509
|
+
}, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth]);
|
|
1510
|
+
const {
|
|
1511
|
+
style: panelStyle = {},
|
|
1512
|
+
...otherPanelProps
|
|
1513
|
+
} = panelProps;
|
|
1514
|
+
const {
|
|
1515
|
+
style: toggleButtonStyle = {},
|
|
1516
|
+
onClick: onToggleClick,
|
|
1517
|
+
...otherToggleButtonProps
|
|
1518
|
+
} = toggleButtonProps;
|
|
1519
|
+
|
|
1520
|
+
// get computed style based on panel position
|
|
1521
|
+
const style = getSidePanelStyle({
|
|
1522
|
+
position: panelPosition,
|
|
1523
|
+
devtoolsTheme: defaultTheme,
|
|
1524
|
+
isOpen: isResolvedOpen,
|
|
1525
|
+
height: devtoolsHeight,
|
|
1526
|
+
width: devtoolsWidth,
|
|
1527
|
+
isResizing,
|
|
1528
|
+
panelStyle
|
|
1529
|
+
});
|
|
1530
|
+
|
|
1531
|
+
// Do not render on the server
|
|
1532
|
+
if (!isMounted()) return null;
|
|
1533
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
1534
|
+
ref: rootRef,
|
|
1535
|
+
className: "ReactQueryDevtools",
|
|
1536
|
+
"aria-label": "React Query Devtools"
|
|
1537
|
+
}, /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
1538
|
+
theme: defaultTheme
|
|
1539
|
+
}, /*#__PURE__*/React.createElement(ReactQueryDevtoolsPanel$2, _extends({
|
|
1540
|
+
ref: panelRef,
|
|
1541
|
+
queryClient: queryClient,
|
|
1542
|
+
styleNonce: styleNonce,
|
|
1543
|
+
position: panelPosition,
|
|
1544
|
+
onPositionChange: setPanelPosition,
|
|
1545
|
+
showCloseButton: true,
|
|
1546
|
+
closeButtonProps: closeButtonProps
|
|
1547
|
+
}, otherPanelProps, {
|
|
1548
|
+
style: style,
|
|
1549
|
+
isOpen: isResolvedOpen,
|
|
1550
|
+
setIsOpen: setIsOpen,
|
|
1551
|
+
onDragStart: e => handleDragStart(panelRef.current, e),
|
|
1552
|
+
errorTypes: errorTypes
|
|
1553
|
+
}))), !isResolvedOpen ? /*#__PURE__*/React.createElement("button", _extends({
|
|
1554
|
+
type: "button"
|
|
1555
|
+
}, otherToggleButtonProps, {
|
|
1556
|
+
"aria-label": "Open React Query Devtools",
|
|
1557
|
+
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
1558
|
+
"aria-haspopup": "true",
|
|
1559
|
+
"aria-expanded": "false",
|
|
1560
|
+
onClick: e => {
|
|
1561
|
+
setIsOpen(true);
|
|
1562
|
+
onToggleClick == null ? void 0 : onToggleClick(e);
|
|
1563
|
+
},
|
|
1383
1564
|
style: {
|
|
1384
|
-
|
|
1385
|
-
|
|
1565
|
+
background: 'none',
|
|
1566
|
+
border: 0,
|
|
1567
|
+
padding: 0,
|
|
1568
|
+
position: 'fixed',
|
|
1569
|
+
zIndex: 99999,
|
|
1570
|
+
display: 'inline-flex',
|
|
1571
|
+
fontSize: '1.5em',
|
|
1572
|
+
margin: '.5em',
|
|
1386
1573
|
cursor: 'pointer',
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1574
|
+
width: 'fit-content',
|
|
1575
|
+
...(position === 'top-right' ? {
|
|
1576
|
+
top: '0',
|
|
1577
|
+
right: '0'
|
|
1578
|
+
} : position === 'top-left' ? {
|
|
1579
|
+
top: '0',
|
|
1580
|
+
left: '0'
|
|
1581
|
+
} : position === 'bottom-right' ? {
|
|
1582
|
+
bottom: '0',
|
|
1583
|
+
right: '0'
|
|
1584
|
+
} : {
|
|
1585
|
+
bottom: '0',
|
|
1586
|
+
left: '0'
|
|
1399
1587
|
}),
|
|
1400
|
-
|
|
1401
|
-
alignItems: 'center',
|
|
1402
|
-
justifyContent: 'center',
|
|
1403
|
-
fontWeight: 'bold',
|
|
1404
|
-
textShadow: isStale ? '0' : '0 0 10px black',
|
|
1405
|
-
color: isStale ? 'black' : 'white'
|
|
1406
|
-
}
|
|
1407
|
-
}, observerCount), isDisabled ? /*#__PURE__*/React.createElement("div", {
|
|
1408
|
-
style: {
|
|
1409
|
-
flex: '0 0 auto',
|
|
1410
|
-
height: '2em',
|
|
1411
|
-
background: defaultTheme.gray,
|
|
1412
|
-
display: 'flex',
|
|
1413
|
-
alignItems: 'center',
|
|
1414
|
-
fontWeight: 'bold',
|
|
1415
|
-
padding: '0 0.5em'
|
|
1416
|
-
}
|
|
1417
|
-
}, "disabled") : null, /*#__PURE__*/React.createElement(Code, {
|
|
1418
|
-
style: {
|
|
1419
|
-
padding: '.5em'
|
|
1588
|
+
...toggleButtonStyle
|
|
1420
1589
|
}
|
|
1421
|
-
},
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1590
|
+
}), /*#__PURE__*/React.createElement(Logo, {
|
|
1591
|
+
"aria-hidden": true
|
|
1592
|
+
}), /*#__PURE__*/React.createElement(ScreenReader, {
|
|
1593
|
+
text: "Open React Query Devtools"
|
|
1594
|
+
})) : null);
|
|
1595
|
+
}
|
|
1426
1596
|
|
|
1427
1597
|
const ReactQueryDevtools = ReactQueryDevtools$1;
|
|
1428
|
-
const ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel$
|
|
1598
|
+
const ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel$2;
|
|
1429
1599
|
|
|
1430
1600
|
export { ReactQueryDevtools, ReactQueryDevtoolsPanel };
|
|
1431
1601
|
//# sourceMappingURL=index.prod.esm.js.map
|