@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
package/build/lib/index.prod.mjs
CHANGED
|
@@ -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,133 @@ 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
|
+
const queryHash = useSubscribeToQueryCache$1(queryCache, () => queryCache.find({
|
|
494
|
+
queryKey
|
|
495
|
+
})?.queryHash) ?? '';
|
|
496
|
+
const queryState = useSubscribeToQueryCache$1(queryCache, () => queryCache.find({
|
|
497
|
+
queryKey
|
|
498
|
+
})?.state);
|
|
499
|
+
const isStale = useSubscribeToQueryCache$1(queryCache, () => queryCache.find({
|
|
500
|
+
queryKey
|
|
501
|
+
})?.isStale()) ?? false;
|
|
502
|
+
const isDisabled = useSubscribeToQueryCache$1(queryCache, () => queryCache.find({
|
|
503
|
+
queryKey
|
|
504
|
+
})?.isDisabled()) ?? false;
|
|
505
|
+
const observerCount = useSubscribeToQueryCache$1(queryCache, () => queryCache.find({
|
|
506
|
+
queryKey
|
|
507
|
+
})?.getObserversCount()) ?? 0;
|
|
508
|
+
if (!queryState) {
|
|
509
|
+
return null;
|
|
510
|
+
}
|
|
511
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
512
|
+
role: "button",
|
|
513
|
+
"aria-label": `Open query details for ${queryHash}`,
|
|
514
|
+
onClick: () => setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash),
|
|
515
|
+
style: {
|
|
516
|
+
display: 'flex',
|
|
517
|
+
borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
|
|
518
|
+
cursor: 'pointer',
|
|
519
|
+
background: queryHash === activeQueryHash ? 'rgba(255,255,255,.1)' : undefined
|
|
520
|
+
}
|
|
521
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
522
|
+
style: {
|
|
523
|
+
flex: '0 0 auto',
|
|
524
|
+
width: '2em',
|
|
525
|
+
height: '2em',
|
|
526
|
+
background: getQueryStatusColor({
|
|
527
|
+
queryState,
|
|
528
|
+
isStale,
|
|
529
|
+
observerCount,
|
|
530
|
+
theme: defaultTheme
|
|
531
|
+
}),
|
|
532
|
+
display: 'flex',
|
|
533
|
+
alignItems: 'center',
|
|
534
|
+
justifyContent: 'center',
|
|
535
|
+
fontWeight: 'bold',
|
|
536
|
+
textShadow: isStale ? '0' : '0 0 10px black',
|
|
537
|
+
color: isStale ? 'black' : 'white'
|
|
538
|
+
}
|
|
539
|
+
}, observerCount), isDisabled ? /*#__PURE__*/React__default.createElement("div", {
|
|
540
|
+
style: {
|
|
541
|
+
flex: '0 0 auto',
|
|
542
|
+
height: '2em',
|
|
543
|
+
background: defaultTheme.gray,
|
|
544
|
+
display: 'flex',
|
|
545
|
+
alignItems: 'center',
|
|
546
|
+
fontWeight: 'bold',
|
|
547
|
+
padding: '0 0.5em'
|
|
548
|
+
}
|
|
549
|
+
}, "disabled") : null, /*#__PURE__*/React__default.createElement(Code, {
|
|
550
|
+
style: {
|
|
551
|
+
padding: '.5em'
|
|
552
|
+
}
|
|
553
|
+
}, `${queryHash}`));
|
|
554
|
+
});
|
|
555
|
+
QueryRow.displayName = 'QueryRow';
|
|
556
|
+
var QueryRow$1 = QueryRow;
|
|
557
|
+
|
|
395
558
|
const Entry = styled('div', {
|
|
396
559
|
fontFamily: 'Menlo, monospace',
|
|
397
560
|
fontSize: '1em',
|
|
@@ -638,354 +801,350 @@ function Explorer({
|
|
|
638
801
|
});
|
|
639
802
|
}
|
|
640
803
|
|
|
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
|
-
}
|
|
804
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
805
|
+
function noop() {}
|
|
667
806
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
807
|
+
/**
|
|
808
|
+
* Panel for the query currently being inspected
|
|
809
|
+
*
|
|
810
|
+
* It displays query details (key, observers...), query actions,
|
|
811
|
+
* the data explorer and the query explorer
|
|
812
|
+
*/
|
|
813
|
+
const ActiveQuery = ({
|
|
814
|
+
queryCache,
|
|
815
|
+
activeQueryHash,
|
|
675
816
|
queryClient,
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
const
|
|
680
|
-
const
|
|
681
|
-
const
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
const
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
const
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
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);
|
|
817
|
+
errorTypes
|
|
818
|
+
}) => {
|
|
819
|
+
const activeQuery = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash));
|
|
820
|
+
const activeQueryState = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.state);
|
|
821
|
+
const isStale = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.isStale()) ?? false;
|
|
822
|
+
const observerCount = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.getObserversCount()) ?? 0;
|
|
823
|
+
const handleRefetch = () => {
|
|
824
|
+
const promise = activeQuery?.fetch();
|
|
825
|
+
promise?.catch(noop);
|
|
826
|
+
};
|
|
827
|
+
const currentErrorTypeName = React__default.useMemo(() => {
|
|
828
|
+
if (activeQuery && activeQueryState?.error) {
|
|
829
|
+
const errorType = errorTypes.find(type => type.initializer(activeQuery).toString() === activeQueryState.error?.toString());
|
|
830
|
+
return errorType?.name;
|
|
831
|
+
}
|
|
832
|
+
return undefined;
|
|
833
|
+
}, [activeQuery, activeQueryState?.error, errorTypes]);
|
|
834
|
+
if (!activeQuery || !activeQueryState) {
|
|
835
|
+
return null;
|
|
836
|
+
}
|
|
837
|
+
const triggerError = errorType => {
|
|
838
|
+
const error = errorType?.initializer(activeQuery) ?? new Error('Unknown error from devtools');
|
|
839
|
+
const __previousQueryOptions = activeQuery.options;
|
|
840
|
+
activeQuery.setState({
|
|
841
|
+
status: 'error',
|
|
842
|
+
error,
|
|
843
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
844
|
+
fetchMeta: {
|
|
845
|
+
...activeQuery.state.fetchMeta,
|
|
846
|
+
__previousQueryOptions
|
|
722
847
|
}
|
|
723
|
-
|
|
724
|
-
document.removeEventListener('mouseUp', unsub, false);
|
|
725
|
-
};
|
|
726
|
-
document.addEventListener('mousemove', run, false);
|
|
727
|
-
document.addEventListener('mouseup', unsub, false);
|
|
848
|
+
});
|
|
728
849
|
};
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
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
|
-
};
|
|
850
|
+
const restoreQueryAfterLoadingOrError = () => {
|
|
851
|
+
activeQuery.fetch(activeQuery.state.fetchMeta.__previousQueryOptions, {
|
|
852
|
+
// Make sure this fetch will cancel the previous one
|
|
853
|
+
cancelRefetch: true
|
|
854
|
+
});
|
|
855
|
+
};
|
|
856
|
+
return /*#__PURE__*/React__default.createElement(ActiveQueryPanel, null, /*#__PURE__*/React__default.createElement("div", {
|
|
857
|
+
style: {
|
|
858
|
+
padding: '.5em',
|
|
859
|
+
background: defaultTheme.backgroundAlt,
|
|
860
|
+
position: 'sticky',
|
|
861
|
+
top: 0,
|
|
862
|
+
zIndex: 1
|
|
754
863
|
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
if (isResolvedOpen && rootRef.current?.parentElement) {
|
|
759
|
-
const {
|
|
760
|
-
parentElement
|
|
761
|
-
} = rootRef.current;
|
|
762
|
-
const styleProp = getSidedProp('padding', panelPosition);
|
|
763
|
-
const isVertical = isVerticalSide(panelPosition);
|
|
764
|
-
const previousPaddings = (({
|
|
765
|
-
padding,
|
|
766
|
-
paddingTop,
|
|
767
|
-
paddingBottom,
|
|
768
|
-
paddingLeft,
|
|
769
|
-
paddingRight
|
|
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
|
-
};
|
|
797
|
-
}
|
|
864
|
+
}, "Query Details"), /*#__PURE__*/React__default.createElement("div", {
|
|
865
|
+
style: {
|
|
866
|
+
padding: '.5em'
|
|
798
867
|
}
|
|
799
|
-
|
|
800
|
-
}, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth]);
|
|
801
|
-
const {
|
|
802
|
-
style: panelStyle = {},
|
|
803
|
-
...otherPanelProps
|
|
804
|
-
} = panelProps;
|
|
805
|
-
const {
|
|
806
|
-
style: toggleButtonStyle = {},
|
|
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
|
-
},
|
|
868
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
854
869
|
style: {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
zIndex: 99999,
|
|
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
|
|
870
|
+
marginBottom: '.5em',
|
|
871
|
+
display: 'flex',
|
|
872
|
+
alignItems: 'flex-start',
|
|
873
|
+
justifyContent: 'space-between'
|
|
879
874
|
}
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
|
|
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 [];
|
|
875
|
+
}, /*#__PURE__*/React__default.createElement(Code, {
|
|
876
|
+
style: {
|
|
877
|
+
lineHeight: '1.8em'
|
|
923
878
|
}
|
|
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, {
|
|
879
|
+
}, /*#__PURE__*/React__default.createElement("pre", {
|
|
937
880
|
style: {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
881
|
+
margin: 0,
|
|
882
|
+
padding: 0,
|
|
883
|
+
overflow: 'auto'
|
|
941
884
|
}
|
|
942
|
-
}), /*#__PURE__*/
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
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
|
-
`
|
|
885
|
+
}, displayValue(activeQuery.queryKey, true))), /*#__PURE__*/React__default.createElement("span", {
|
|
886
|
+
style: {
|
|
887
|
+
padding: '0.3em .6em',
|
|
888
|
+
borderRadius: '0.4em',
|
|
889
|
+
fontWeight: 'bold',
|
|
890
|
+
textShadow: '0 2px 10px black',
|
|
891
|
+
background: getQueryStatusColor({
|
|
892
|
+
queryState: activeQueryState,
|
|
893
|
+
isStale: isStale,
|
|
894
|
+
observerCount: observerCount,
|
|
895
|
+
theme: defaultTheme
|
|
896
|
+
}),
|
|
897
|
+
flexShrink: 0
|
|
965
898
|
}
|
|
966
|
-
}), /*#__PURE__*/
|
|
967
|
-
style: getResizeHandleStyle(position),
|
|
968
|
-
onMouseDown: onDragStart
|
|
969
|
-
}), isOpen && /*#__PURE__*/React.createElement("div", {
|
|
899
|
+
}, getQueryStatusLabel(activeQuery))), /*#__PURE__*/React__default.createElement("div", {
|
|
970
900
|
style: {
|
|
971
|
-
|
|
972
|
-
minHeight: '40%',
|
|
973
|
-
maxHeight: '100%',
|
|
974
|
-
overflow: 'auto',
|
|
975
|
-
borderRight: `1px solid ${defaultTheme.grayAlt}`,
|
|
901
|
+
marginBottom: '.5em',
|
|
976
902
|
display: 'flex',
|
|
977
|
-
|
|
903
|
+
alignItems: 'center',
|
|
904
|
+
justifyContent: 'space-between'
|
|
978
905
|
}
|
|
979
|
-
}, /*#__PURE__*/
|
|
906
|
+
}, "Observers: ", /*#__PURE__*/React__default.createElement(Code, null, observerCount)), /*#__PURE__*/React__default.createElement("div", {
|
|
980
907
|
style: {
|
|
981
|
-
padding: '.5em',
|
|
982
|
-
background: defaultTheme.backgroundAlt,
|
|
983
908
|
display: 'flex',
|
|
984
|
-
|
|
985
|
-
|
|
909
|
+
alignItems: 'center',
|
|
910
|
+
justifyContent: 'space-between'
|
|
986
911
|
}
|
|
987
|
-
}, /*#__PURE__*/
|
|
988
|
-
|
|
912
|
+
}, "Last Updated:", ' ', /*#__PURE__*/React__default.createElement(Code, null, new Date(activeQueryState.dataUpdatedAt).toLocaleTimeString()))), /*#__PURE__*/React__default.createElement("div", {
|
|
913
|
+
style: {
|
|
914
|
+
background: defaultTheme.backgroundAlt,
|
|
915
|
+
padding: '.5em',
|
|
916
|
+
position: 'sticky',
|
|
917
|
+
top: 0,
|
|
918
|
+
zIndex: 1
|
|
919
|
+
}
|
|
920
|
+
}, "Actions"), /*#__PURE__*/React__default.createElement("div", {
|
|
921
|
+
style: {
|
|
922
|
+
padding: '0.5em',
|
|
923
|
+
display: 'flex',
|
|
924
|
+
flexWrap: 'wrap',
|
|
925
|
+
gap: '0.5em',
|
|
926
|
+
alignItems: 'flex-end'
|
|
927
|
+
}
|
|
928
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
929
|
+
type: "button",
|
|
930
|
+
onClick: handleRefetch,
|
|
931
|
+
disabled: activeQueryState.fetchStatus === 'fetching',
|
|
932
|
+
style: {
|
|
933
|
+
background: defaultTheme.active
|
|
934
|
+
}
|
|
935
|
+
}, "Refetch"), ' ', /*#__PURE__*/React__default.createElement(Button, {
|
|
936
|
+
type: "button",
|
|
937
|
+
onClick: () => queryClient.invalidateQueries(activeQuery),
|
|
938
|
+
style: {
|
|
939
|
+
background: defaultTheme.warning,
|
|
940
|
+
color: defaultTheme.inputTextColor
|
|
941
|
+
}
|
|
942
|
+
}, "Invalidate"), ' ', /*#__PURE__*/React__default.createElement(Button, {
|
|
943
|
+
type: "button",
|
|
944
|
+
onClick: () => queryClient.resetQueries(activeQuery),
|
|
945
|
+
style: {
|
|
946
|
+
background: defaultTheme.gray
|
|
947
|
+
}
|
|
948
|
+
}, "Reset"), ' ', /*#__PURE__*/React__default.createElement(Button, {
|
|
949
|
+
type: "button",
|
|
950
|
+
onClick: () => queryClient.removeQueries(activeQuery),
|
|
951
|
+
style: {
|
|
952
|
+
background: defaultTheme.danger
|
|
953
|
+
}
|
|
954
|
+
}, "Remove"), ' ', /*#__PURE__*/React__default.createElement(Button, {
|
|
955
|
+
type: "button",
|
|
956
|
+
onClick: () => {
|
|
957
|
+
if (activeQuery.state.data === undefined) {
|
|
958
|
+
restoreQueryAfterLoadingOrError();
|
|
959
|
+
} else {
|
|
960
|
+
const __previousQueryOptions = activeQuery.options;
|
|
961
|
+
// Trigger a fetch in order to trigger suspense as well.
|
|
962
|
+
activeQuery.fetch({
|
|
963
|
+
...__previousQueryOptions,
|
|
964
|
+
queryFn: () => {
|
|
965
|
+
return new Promise(() => {
|
|
966
|
+
// Never resolve
|
|
967
|
+
});
|
|
968
|
+
},
|
|
969
|
+
gcTime: -1
|
|
970
|
+
});
|
|
971
|
+
activeQuery.setState({
|
|
972
|
+
data: undefined,
|
|
973
|
+
status: 'pending',
|
|
974
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
975
|
+
fetchMeta: {
|
|
976
|
+
...activeQuery.state.fetchMeta,
|
|
977
|
+
__previousQueryOptions
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
style: {
|
|
983
|
+
background: defaultTheme.paused
|
|
984
|
+
}
|
|
985
|
+
}, activeQuery.state.status === 'pending' ? 'Restore' : 'Trigger', ' ', "loading"), ' ', errorTypes.length === 0 || activeQuery.state.status === 'error' ? /*#__PURE__*/React__default.createElement(Button, {
|
|
986
|
+
type: "button",
|
|
987
|
+
onClick: () => {
|
|
988
|
+
if (!activeQuery.state.error) {
|
|
989
|
+
triggerError();
|
|
990
|
+
} else {
|
|
991
|
+
queryClient.resetQueries(activeQuery);
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
style: {
|
|
995
|
+
background: defaultTheme.danger
|
|
996
|
+
}
|
|
997
|
+
}, activeQuery.state.status === 'error' ? 'Restore' : 'Trigger', " error") : /*#__PURE__*/React__default.createElement("label", null, "Trigger error:", /*#__PURE__*/React__default.createElement(Select, {
|
|
998
|
+
value: currentErrorTypeName ?? '',
|
|
999
|
+
style: {
|
|
1000
|
+
marginInlineStart: '.5em'
|
|
1001
|
+
},
|
|
1002
|
+
onChange: e => {
|
|
1003
|
+
const errorType = errorTypes.find(t => t.name === e.target.value);
|
|
1004
|
+
triggerError(errorType);
|
|
1005
|
+
}
|
|
1006
|
+
}, /*#__PURE__*/React__default.createElement("option", {
|
|
1007
|
+
key: "",
|
|
1008
|
+
value: ""
|
|
1009
|
+
}), errorTypes.map(errorType => /*#__PURE__*/React__default.createElement("option", {
|
|
1010
|
+
key: errorType.name,
|
|
1011
|
+
value: errorType.name
|
|
1012
|
+
}, errorType.name))))), /*#__PURE__*/React__default.createElement("div", {
|
|
1013
|
+
style: {
|
|
1014
|
+
background: defaultTheme.backgroundAlt,
|
|
1015
|
+
padding: '.5em',
|
|
1016
|
+
position: 'sticky',
|
|
1017
|
+
top: 0,
|
|
1018
|
+
zIndex: 1
|
|
1019
|
+
}
|
|
1020
|
+
}, "Data Explorer"), /*#__PURE__*/React__default.createElement("div", {
|
|
1021
|
+
style: {
|
|
1022
|
+
padding: '.5em'
|
|
1023
|
+
}
|
|
1024
|
+
}, /*#__PURE__*/React__default.createElement(Explorer, {
|
|
1025
|
+
label: "Data",
|
|
1026
|
+
value: activeQueryState.data,
|
|
1027
|
+
defaultExpanded: {},
|
|
1028
|
+
copyable: true
|
|
1029
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
1030
|
+
style: {
|
|
1031
|
+
background: defaultTheme.backgroundAlt,
|
|
1032
|
+
padding: '.5em',
|
|
1033
|
+
position: 'sticky',
|
|
1034
|
+
top: 0,
|
|
1035
|
+
zIndex: 1
|
|
1036
|
+
}
|
|
1037
|
+
}, "Query Explorer"), /*#__PURE__*/React__default.createElement("div", {
|
|
1038
|
+
style: {
|
|
1039
|
+
padding: '.5em'
|
|
1040
|
+
}
|
|
1041
|
+
}, /*#__PURE__*/React__default.createElement(Explorer, {
|
|
1042
|
+
label: "Query",
|
|
1043
|
+
value: activeQuery,
|
|
1044
|
+
defaultExpanded: {
|
|
1045
|
+
queryKey: true
|
|
1046
|
+
}
|
|
1047
|
+
})));
|
|
1048
|
+
};
|
|
1049
|
+
ActiveQuery.displayName = 'ActiveQuery';
|
|
1050
|
+
var ActiveQuery$1 = ActiveQuery;
|
|
1051
|
+
|
|
1052
|
+
const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__default.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
|
|
1053
|
+
const {
|
|
1054
|
+
isOpen = true,
|
|
1055
|
+
styleNonce,
|
|
1056
|
+
setIsOpen,
|
|
1057
|
+
queryClient,
|
|
1058
|
+
onDragStart,
|
|
1059
|
+
onPositionChange,
|
|
1060
|
+
showCloseButton,
|
|
1061
|
+
position,
|
|
1062
|
+
closeButtonProps = {},
|
|
1063
|
+
errorTypes = [],
|
|
1064
|
+
...panelProps
|
|
1065
|
+
} = props;
|
|
1066
|
+
const {
|
|
1067
|
+
onClick: onCloseClick,
|
|
1068
|
+
...otherCloseButtonProps
|
|
1069
|
+
} = closeButtonProps;
|
|
1070
|
+
const client = useQueryClient(queryClient);
|
|
1071
|
+
const queryCache = client.getQueryCache();
|
|
1072
|
+
const [sort, setSort] = useLocalStorage('reactQueryDevtoolsSortFn', Object.keys(sortFns)[0]);
|
|
1073
|
+
const [filter, setFilter] = useLocalStorage('reactQueryDevtoolsFilter', '');
|
|
1074
|
+
const [baseSort, setBaseSort] = useLocalStorage('reactQueryDevtoolsBaseSort', 1);
|
|
1075
|
+
const sortFn = React__default.useMemo(() => sortFns[sort], [sort]);
|
|
1076
|
+
const queriesCount = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().length, !isOpen);
|
|
1077
|
+
const [activeQueryHash, setActiveQueryHash] = useLocalStorage('reactQueryDevtoolsActiveQueryHash', '');
|
|
1078
|
+
const queries = React__default.useMemo(() => {
|
|
1079
|
+
const unsortedQueries = queryCache.getAll();
|
|
1080
|
+
if (queriesCount === 0) {
|
|
1081
|
+
return [];
|
|
1082
|
+
}
|
|
1083
|
+
const filtered = filter ? unsortedQueries.filter(item => rankItem(item.queryHash, filter).passed) : [...unsortedQueries];
|
|
1084
|
+
const sorted = sortFn ? filtered.sort((a, b) => sortFn(a, b) * baseSort) : filtered;
|
|
1085
|
+
return sorted;
|
|
1086
|
+
}, [baseSort, sortFn, filter, queriesCount, queryCache]);
|
|
1087
|
+
const [isMockOffline, setMockOffline] = React__default.useState(false);
|
|
1088
|
+
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
1089
|
+
theme: defaultTheme
|
|
1090
|
+
}, /*#__PURE__*/React__default.createElement(Panel, _extends({
|
|
1091
|
+
ref: ref,
|
|
1092
|
+
className: "ReactQueryDevtoolsPanel",
|
|
1093
|
+
"aria-label": "React Query Devtools Panel",
|
|
1094
|
+
id: "ReactQueryDevtoolsPanel"
|
|
1095
|
+
}, panelProps, {
|
|
1096
|
+
style: {
|
|
1097
|
+
height: defaultPanelSize,
|
|
1098
|
+
position: 'relative',
|
|
1099
|
+
...panelProps.style
|
|
1100
|
+
}
|
|
1101
|
+
}), /*#__PURE__*/React__default.createElement("style", {
|
|
1102
|
+
nonce: styleNonce,
|
|
1103
|
+
dangerouslySetInnerHTML: {
|
|
1104
|
+
__html: `
|
|
1105
|
+
.ReactQueryDevtoolsPanel * {
|
|
1106
|
+
scrollbar-color: ${defaultTheme.backgroundAlt} ${defaultTheme.gray};
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar, .ReactQueryDevtoolsPanel scrollbar {
|
|
1110
|
+
width: 1em;
|
|
1111
|
+
height: 1em;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar-track, .ReactQueryDevtoolsPanel scrollbar-track {
|
|
1115
|
+
background: ${defaultTheme.backgroundAlt};
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar-thumb, .ReactQueryDevtoolsPanel scrollbar-thumb {
|
|
1119
|
+
background: ${defaultTheme.gray};
|
|
1120
|
+
border-radius: .5em;
|
|
1121
|
+
border: 3px solid ${defaultTheme.backgroundAlt};
|
|
1122
|
+
}
|
|
1123
|
+
`
|
|
1124
|
+
}
|
|
1125
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1126
|
+
style: getResizeHandleStyle(position),
|
|
1127
|
+
onMouseDown: onDragStart
|
|
1128
|
+
}), isOpen && /*#__PURE__*/React__default.createElement("div", {
|
|
1129
|
+
style: {
|
|
1130
|
+
flex: '1 1 500px',
|
|
1131
|
+
minHeight: '40%',
|
|
1132
|
+
maxHeight: '100%',
|
|
1133
|
+
overflow: 'auto',
|
|
1134
|
+
borderRight: `1px solid ${defaultTheme.grayAlt}`,
|
|
1135
|
+
display: 'flex',
|
|
1136
|
+
flexDirection: 'column'
|
|
1137
|
+
}
|
|
1138
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1139
|
+
style: {
|
|
1140
|
+
padding: '.5em',
|
|
1141
|
+
background: defaultTheme.backgroundAlt,
|
|
1142
|
+
display: 'flex',
|
|
1143
|
+
justifyContent: 'space-between',
|
|
1144
|
+
alignItems: 'center'
|
|
1145
|
+
}
|
|
1146
|
+
}, /*#__PURE__*/React__default.createElement("button", {
|
|
1147
|
+
type: "button",
|
|
989
1148
|
"aria-label": "Close React Query Devtools",
|
|
990
1149
|
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
991
1150
|
"aria-haspopup": "true",
|
|
@@ -999,45 +1158,47 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
999
1158
|
marginRight: '.5em',
|
|
1000
1159
|
cursor: 'pointer'
|
|
1001
1160
|
}
|
|
1002
|
-
}, /*#__PURE__*/
|
|
1161
|
+
}, /*#__PURE__*/React__default.createElement(Logo, {
|
|
1003
1162
|
"aria-hidden": true
|
|
1004
|
-
}), /*#__PURE__*/
|
|
1163
|
+
}), /*#__PURE__*/React__default.createElement(ScreenReader, {
|
|
1005
1164
|
text: "Close React Query Devtools"
|
|
1006
|
-
})), /*#__PURE__*/
|
|
1165
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
1007
1166
|
style: {
|
|
1008
1167
|
display: 'flex',
|
|
1009
1168
|
flexDirection: 'column'
|
|
1010
1169
|
}
|
|
1011
|
-
}, /*#__PURE__*/
|
|
1170
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1012
1171
|
style: {
|
|
1013
1172
|
display: 'flex',
|
|
1014
1173
|
justifyContent: 'space-between',
|
|
1015
1174
|
alignItems: 'center',
|
|
1016
1175
|
marginBottom: '.5em'
|
|
1017
1176
|
}
|
|
1018
|
-
}, /*#__PURE__*/
|
|
1177
|
+
}, /*#__PURE__*/React__default.createElement(QueryStatusCount, {
|
|
1019
1178
|
queryCache: queryCache
|
|
1020
|
-
}), position && onPositionChange ? /*#__PURE__*/
|
|
1179
|
+
}), position && onPositionChange ? /*#__PURE__*/React__default.createElement(Select, {
|
|
1021
1180
|
"aria-label": "Panel position",
|
|
1022
1181
|
value: position,
|
|
1023
1182
|
style: {
|
|
1024
1183
|
marginInlineStart: '.5em'
|
|
1025
1184
|
},
|
|
1026
1185
|
onChange: e => onPositionChange(e.target.value)
|
|
1027
|
-
}, /*#__PURE__*/
|
|
1186
|
+
}, /*#__PURE__*/React__default.createElement("option", {
|
|
1028
1187
|
value: "left"
|
|
1029
|
-
}, "Left"), /*#__PURE__*/
|
|
1188
|
+
}, "Left"), /*#__PURE__*/React__default.createElement("option", {
|
|
1030
1189
|
value: "right"
|
|
1031
|
-
}, "Right"), /*#__PURE__*/
|
|
1190
|
+
}, "Right"), /*#__PURE__*/React__default.createElement("option", {
|
|
1032
1191
|
value: "top"
|
|
1033
|
-
}, "Top"), /*#__PURE__*/
|
|
1192
|
+
}, "Top"), /*#__PURE__*/React__default.createElement("option", {
|
|
1034
1193
|
value: "bottom"
|
|
1035
|
-
}, "Bottom")) : null), /*#__PURE__*/
|
|
1194
|
+
}, "Bottom")) : null), /*#__PURE__*/React__default.createElement("div", {
|
|
1036
1195
|
style: {
|
|
1037
1196
|
display: 'flex',
|
|
1038
|
-
alignItems: 'center'
|
|
1197
|
+
alignItems: 'center',
|
|
1198
|
+
flexWrap: 'wrap',
|
|
1199
|
+
gap: '0.5em'
|
|
1039
1200
|
}
|
|
1040
|
-
}, /*#__PURE__*/
|
|
1201
|
+
}, /*#__PURE__*/React__default.createElement(Input, {
|
|
1041
1202
|
placeholder: "Filter",
|
|
1042
1203
|
"aria-label": "Filter by queryhash",
|
|
1043
1204
|
value: filter ?? '',
|
|
@@ -1047,10 +1208,9 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1047
1208
|
},
|
|
1048
1209
|
style: {
|
|
1049
1210
|
flex: '1',
|
|
1050
|
-
marginRight: '.5em',
|
|
1051
1211
|
width: '100%'
|
|
1052
1212
|
}
|
|
1053
|
-
}), /*#__PURE__*/
|
|
1213
|
+
}), /*#__PURE__*/React__default.createElement(Select, {
|
|
1054
1214
|
"aria-label": "Sort queries",
|
|
1055
1215
|
value: sort,
|
|
1056
1216
|
onChange: e => setSort(e.target.value),
|
|
@@ -1059,17 +1219,26 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1059
1219
|
minWidth: 75,
|
|
1060
1220
|
marginRight: '.5em'
|
|
1061
1221
|
}
|
|
1062
|
-
}, Object.keys(sortFns).map(key => /*#__PURE__*/
|
|
1222
|
+
}, Object.keys(sortFns).map(key => /*#__PURE__*/React__default.createElement("option", {
|
|
1063
1223
|
key: key,
|
|
1064
1224
|
value: key
|
|
1065
|
-
}, "Sort by ", key))), /*#__PURE__*/
|
|
1225
|
+
}, "Sort by ", key))), /*#__PURE__*/React__default.createElement(Button, {
|
|
1066
1226
|
type: "button",
|
|
1067
1227
|
onClick: () => setBaseSort(old => old * -1),
|
|
1068
1228
|
style: {
|
|
1069
1229
|
padding: '.3em .4em',
|
|
1070
1230
|
marginRight: '.5em'
|
|
1071
1231
|
}
|
|
1072
|
-
}, baseSort === 1 ? '⬆ Asc' : '⬇ Desc'), /*#__PURE__*/
|
|
1232
|
+
}, baseSort === 1 ? '⬆ Asc' : '⬇ Desc'), /*#__PURE__*/React__default.createElement(Button, {
|
|
1233
|
+
title: "Clear cache",
|
|
1234
|
+
"aria-label": "Clear cache",
|
|
1235
|
+
type: "button",
|
|
1236
|
+
onClick: () => queryCache.clear(),
|
|
1237
|
+
style: {
|
|
1238
|
+
padding: '.3em .4em',
|
|
1239
|
+
marginRight: '.5em'
|
|
1240
|
+
}
|
|
1241
|
+
}, "Clear"), /*#__PURE__*/React__default.createElement(Button, {
|
|
1073
1242
|
type: "button",
|
|
1074
1243
|
onClick: () => {
|
|
1075
1244
|
if (isMockOffline) {
|
|
@@ -1079,6 +1248,7 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1079
1248
|
} else {
|
|
1080
1249
|
onlineManager.setOnline(false);
|
|
1081
1250
|
setMockOffline(true);
|
|
1251
|
+
window.dispatchEvent(new Event('offline'));
|
|
1082
1252
|
}
|
|
1083
1253
|
},
|
|
1084
1254
|
"aria-label": isMockOffline ? 'Restore offline mock' : 'Mock offline behavior',
|
|
@@ -1087,68 +1257,69 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1087
1257
|
padding: '0',
|
|
1088
1258
|
height: '2em'
|
|
1089
1259
|
}
|
|
1090
|
-
}, /*#__PURE__*/
|
|
1260
|
+
}, /*#__PURE__*/React__default.createElement("svg", {
|
|
1091
1261
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1092
1262
|
width: "2em",
|
|
1093
1263
|
height: "2em",
|
|
1094
1264
|
viewBox: "0 0 24 24",
|
|
1095
1265
|
stroke: isMockOffline ? defaultTheme.danger : 'currentColor',
|
|
1096
1266
|
fill: "none"
|
|
1097
|
-
}, isMockOffline ? /*#__PURE__*/
|
|
1267
|
+
}, isMockOffline ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("path", {
|
|
1098
1268
|
stroke: "none",
|
|
1099
1269
|
d: "M0 0h24v24H0z",
|
|
1100
1270
|
fill: "none"
|
|
1101
|
-
}), /*#__PURE__*/
|
|
1271
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
1102
1272
|
x1: "12",
|
|
1103
1273
|
y1: "18",
|
|
1104
1274
|
x2: "12.01",
|
|
1105
1275
|
y2: "18"
|
|
1106
|
-
}), /*#__PURE__*/
|
|
1276
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1107
1277
|
d: "M9.172 15.172a4 4 0 0 1 5.656 0"
|
|
1108
|
-
}), /*#__PURE__*/
|
|
1278
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1109
1279
|
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__*/
|
|
1280
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1111
1281
|
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__*/
|
|
1282
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
1113
1283
|
x1: "3",
|
|
1114
1284
|
y1: "3",
|
|
1115
1285
|
x2: "21",
|
|
1116
1286
|
y2: "21"
|
|
1117
|
-
})) : /*#__PURE__*/
|
|
1287
|
+
})) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("path", {
|
|
1118
1288
|
stroke: "none",
|
|
1119
1289
|
d: "M0 0h24v24H0z",
|
|
1120
1290
|
fill: "none"
|
|
1121
|
-
}), /*#__PURE__*/
|
|
1291
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
1122
1292
|
x1: "12",
|
|
1123
1293
|
y1: "18",
|
|
1124
1294
|
x2: "12.01",
|
|
1125
1295
|
y2: "18"
|
|
1126
|
-
}), /*#__PURE__*/
|
|
1296
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1127
1297
|
d: "M9.172 15.172a4 4 0 0 1 5.656 0"
|
|
1128
|
-
}), /*#__PURE__*/
|
|
1298
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1129
1299
|
d: "M6.343 12.343a8 8 0 0 1 11.314 0"
|
|
1130
|
-
}), /*#__PURE__*/
|
|
1300
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1131
1301
|
d: "M3.515 9.515c4.686 -4.687 12.284 -4.687 17 0"
|
|
1132
|
-
}))), /*#__PURE__*/
|
|
1302
|
+
}))), /*#__PURE__*/React__default.createElement(ScreenReader, {
|
|
1133
1303
|
text: isMockOffline ? 'Restore offline mock' : 'Mock offline behavior'
|
|
1134
|
-
}))))), /*#__PURE__*/
|
|
1304
|
+
}))))), /*#__PURE__*/React__default.createElement("div", {
|
|
1135
1305
|
style: {
|
|
1136
1306
|
overflowY: 'auto',
|
|
1137
1307
|
flex: '1'
|
|
1138
1308
|
}
|
|
1139
1309
|
}, queries.map(query => {
|
|
1140
|
-
return /*#__PURE__*/
|
|
1310
|
+
return /*#__PURE__*/React__default.createElement(QueryRow$1, {
|
|
1141
1311
|
queryKey: query.queryKey,
|
|
1142
1312
|
activeQueryHash: activeQueryHash,
|
|
1143
1313
|
setActiveQueryHash: setActiveQueryHash,
|
|
1144
1314
|
key: query.queryHash,
|
|
1145
1315
|
queryCache: queryCache
|
|
1146
1316
|
});
|
|
1147
|
-
}))), activeQueryHash && isOpen ? /*#__PURE__*/
|
|
1317
|
+
}))), activeQueryHash && isOpen ? /*#__PURE__*/React__default.createElement(ActiveQuery$1, {
|
|
1148
1318
|
activeQueryHash: activeQueryHash,
|
|
1149
1319
|
queryCache: queryCache,
|
|
1150
|
-
queryClient: client
|
|
1151
|
-
|
|
1320
|
+
queryClient: client,
|
|
1321
|
+
errorTypes: errorTypes
|
|
1322
|
+
}) : null, showCloseButton ? /*#__PURE__*/React__default.createElement(Button, _extends({
|
|
1152
1323
|
type: "button",
|
|
1153
1324
|
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
1154
1325
|
"aria-haspopup": "true",
|
|
@@ -1168,264 +1339,232 @@ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQu
|
|
|
1168
1339
|
}
|
|
1169
1340
|
}), "Close") : null));
|
|
1170
1341
|
});
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1342
|
+
ReactQueryDevtoolsPanel$1.displayName = 'ReactQueryDevtoolsPanel';
|
|
1343
|
+
var ReactQueryDevtoolsPanel$2 = ReactQueryDevtoolsPanel$1;
|
|
1344
|
+
|
|
1345
|
+
function ReactQueryDevtools$1({
|
|
1346
|
+
initialIsOpen,
|
|
1347
|
+
panelProps = {},
|
|
1348
|
+
closeButtonProps = {},
|
|
1349
|
+
toggleButtonProps = {},
|
|
1350
|
+
position = 'bottom-left',
|
|
1351
|
+
containerElement: Container = 'aside',
|
|
1352
|
+
queryClient,
|
|
1353
|
+
styleNonce,
|
|
1354
|
+
panelPosition: initialPanelPosition = 'bottom',
|
|
1355
|
+
errorTypes = []
|
|
1356
|
+
}) {
|
|
1357
|
+
const rootRef = React.useRef(null);
|
|
1358
|
+
const panelRef = React.useRef(null);
|
|
1359
|
+
const [isOpen, setIsOpen] = useLocalStorage('reactQueryDevtoolsOpen', initialIsOpen);
|
|
1360
|
+
const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage('reactQueryDevtoolsHeight', defaultPanelSize);
|
|
1361
|
+
const [devtoolsWidth, setDevtoolsWidth] = useLocalStorage('reactQueryDevtoolsWidth', defaultPanelSize);
|
|
1362
|
+
const [panelPosition = 'bottom', setPanelPosition] = useLocalStorage('reactQueryDevtoolsPanelPosition', initialPanelPosition);
|
|
1363
|
+
const [isResolvedOpen, setIsResolvedOpen] = React.useState(false);
|
|
1364
|
+
const [isResizing, setIsResizing] = React.useState(false);
|
|
1365
|
+
const isMounted = useIsMounted();
|
|
1366
|
+
const handleDragStart = (panelElement, startEvent) => {
|
|
1367
|
+
if (!panelElement) return;
|
|
1368
|
+
if (startEvent.button !== 0) return; // Only allow left click for drag
|
|
1369
|
+
const isVertical = isVerticalSide(panelPosition);
|
|
1370
|
+
setIsResizing(true);
|
|
1371
|
+
const {
|
|
1372
|
+
height,
|
|
1373
|
+
width
|
|
1374
|
+
} = panelElement.getBoundingClientRect();
|
|
1375
|
+
const startX = startEvent.clientX;
|
|
1376
|
+
const startY = startEvent.clientY;
|
|
1377
|
+
let newSize = 0;
|
|
1378
|
+
const run = moveEvent => {
|
|
1379
|
+
// prevent mouse selecting stuff with mouse drag
|
|
1380
|
+
moveEvent.preventDefault();
|
|
1381
|
+
|
|
1382
|
+
// calculate the correct size based on mouse position and current panel position
|
|
1383
|
+
// hint: it is different formula for the opposite sides
|
|
1384
|
+
if (isVertical) {
|
|
1385
|
+
newSize = width + (panelPosition === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX);
|
|
1386
|
+
setDevtoolsWidth(newSize);
|
|
1387
|
+
} else {
|
|
1388
|
+
newSize = height + (panelPosition === 'bottom' ? startY - moveEvent.clientY : moveEvent.clientY - startY);
|
|
1389
|
+
setDevtoolsHeight(newSize);
|
|
1390
|
+
}
|
|
1391
|
+
if (newSize < minPanelSize) {
|
|
1392
|
+
setIsOpen(false);
|
|
1393
|
+
} else {
|
|
1394
|
+
setIsOpen(true);
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
const unsub = () => {
|
|
1398
|
+
if (isResizing) {
|
|
1399
|
+
setIsResizing(false);
|
|
1400
|
+
}
|
|
1401
|
+
document.removeEventListener('mousemove', run, false);
|
|
1402
|
+
document.removeEventListener('mouseUp', unsub, false);
|
|
1403
|
+
};
|
|
1404
|
+
document.addEventListener('mousemove', run, false);
|
|
1405
|
+
document.addEventListener('mouseup', unsub, false);
|
|
1183
1406
|
};
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1407
|
+
React.useEffect(() => {
|
|
1408
|
+
setIsResolvedOpen(isOpen ?? false);
|
|
1409
|
+
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
1410
|
+
|
|
1411
|
+
// Toggle panel visibility before/after transition (depending on direction).
|
|
1412
|
+
// Prevents focusing in a closed panel.
|
|
1413
|
+
React.useEffect(() => {
|
|
1414
|
+
const ref = panelRef.current;
|
|
1415
|
+
if (ref) {
|
|
1416
|
+
const handlePanelTransitionStart = () => {
|
|
1417
|
+
if (isResolvedOpen) {
|
|
1418
|
+
ref.style.visibility = 'visible';
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
const handlePanelTransitionEnd = () => {
|
|
1422
|
+
if (!isResolvedOpen) {
|
|
1423
|
+
ref.style.visibility = 'hidden';
|
|
1424
|
+
}
|
|
1425
|
+
};
|
|
1426
|
+
ref.addEventListener('transitionstart', handlePanelTransitionStart);
|
|
1427
|
+
ref.addEventListener('transitionend', handlePanelTransitionEnd);
|
|
1428
|
+
return () => {
|
|
1429
|
+
ref.removeEventListener('transitionstart', handlePanelTransitionStart);
|
|
1430
|
+
ref.removeEventListener('transitionend', handlePanelTransitionEnd);
|
|
1431
|
+
};
|
|
1205
1432
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1433
|
+
return;
|
|
1434
|
+
}, [isResolvedOpen]);
|
|
1435
|
+
React.useEffect(() => {
|
|
1436
|
+
if (isResolvedOpen && rootRef.current?.parentElement) {
|
|
1437
|
+
const {
|
|
1438
|
+
parentElement
|
|
1439
|
+
} = rootRef.current;
|
|
1440
|
+
const styleProp = getSidedProp('padding', panelPosition);
|
|
1441
|
+
const isVertical = isVerticalSide(panelPosition);
|
|
1442
|
+
const previousPaddings = (({
|
|
1443
|
+
padding,
|
|
1444
|
+
paddingTop,
|
|
1445
|
+
paddingBottom,
|
|
1446
|
+
paddingLeft,
|
|
1447
|
+
paddingRight
|
|
1448
|
+
}) => ({
|
|
1449
|
+
padding,
|
|
1450
|
+
paddingTop,
|
|
1451
|
+
paddingBottom,
|
|
1452
|
+
paddingLeft,
|
|
1453
|
+
paddingRight
|
|
1454
|
+
}))(parentElement.style);
|
|
1455
|
+
const run = () => {
|
|
1456
|
+
// reset the padding
|
|
1457
|
+
parentElement.style.padding = '0px';
|
|
1458
|
+
parentElement.style.paddingTop = '0px';
|
|
1459
|
+
parentElement.style.paddingBottom = '0px';
|
|
1460
|
+
parentElement.style.paddingLeft = '0px';
|
|
1461
|
+
parentElement.style.paddingRight = '0px';
|
|
1462
|
+
// set the new padding based on the new panel position
|
|
1463
|
+
|
|
1464
|
+
parentElement.style[styleProp] = `${isVertical ? devtoolsWidth : devtoolsHeight}px`;
|
|
1465
|
+
};
|
|
1466
|
+
run();
|
|
1467
|
+
if (typeof window !== 'undefined') {
|
|
1468
|
+
window.addEventListener('resize', run);
|
|
1469
|
+
return () => {
|
|
1470
|
+
window.removeEventListener('resize', run);
|
|
1471
|
+
Object.entries(previousPaddings).forEach(([property, previousValue]) => {
|
|
1472
|
+
parentElement.style[property] = previousValue;
|
|
1473
|
+
});
|
|
1474
|
+
};
|
|
1475
|
+
}
|
|
1209
1476
|
}
|
|
1210
|
-
|
|
1477
|
+
return;
|
|
1478
|
+
}, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth]);
|
|
1479
|
+
const {
|
|
1480
|
+
style: panelStyle = {},
|
|
1481
|
+
...otherPanelProps
|
|
1482
|
+
} = panelProps;
|
|
1483
|
+
const {
|
|
1484
|
+
style: toggleButtonStyle = {},
|
|
1485
|
+
onClick: onToggleClick,
|
|
1486
|
+
...otherToggleButtonProps
|
|
1487
|
+
} = toggleButtonProps;
|
|
1488
|
+
|
|
1489
|
+
// get computed style based on panel position
|
|
1490
|
+
const style = getSidePanelStyle({
|
|
1491
|
+
position: panelPosition,
|
|
1492
|
+
devtoolsTheme: defaultTheme,
|
|
1493
|
+
isOpen: isResolvedOpen,
|
|
1494
|
+
height: devtoolsHeight,
|
|
1495
|
+
width: devtoolsWidth,
|
|
1496
|
+
isResizing,
|
|
1497
|
+
panelStyle
|
|
1498
|
+
});
|
|
1499
|
+
|
|
1500
|
+
// Do not render on the server
|
|
1501
|
+
if (!isMounted()) return null;
|
|
1502
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
1503
|
+
ref: rootRef,
|
|
1504
|
+
className: "ReactQueryDevtools",
|
|
1505
|
+
"aria-label": "React Query Devtools"
|
|
1506
|
+
}, /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
1507
|
+
theme: defaultTheme
|
|
1508
|
+
}, /*#__PURE__*/React.createElement(ReactQueryDevtoolsPanel$2, _extends({
|
|
1509
|
+
ref: panelRef,
|
|
1510
|
+
queryClient: queryClient,
|
|
1511
|
+
styleNonce: styleNonce,
|
|
1512
|
+
position: panelPosition,
|
|
1513
|
+
onPositionChange: setPanelPosition,
|
|
1514
|
+
showCloseButton: true,
|
|
1515
|
+
closeButtonProps: closeButtonProps
|
|
1516
|
+
}, otherPanelProps, {
|
|
1517
|
+
style: style,
|
|
1518
|
+
isOpen: isResolvedOpen,
|
|
1519
|
+
setIsOpen: setIsOpen,
|
|
1520
|
+
onDragStart: e => handleDragStart(panelRef.current, e),
|
|
1521
|
+
errorTypes: errorTypes
|
|
1522
|
+
}))), !isResolvedOpen ? /*#__PURE__*/React.createElement("button", _extends({
|
|
1523
|
+
type: "button"
|
|
1524
|
+
}, otherToggleButtonProps, {
|
|
1525
|
+
"aria-label": "Open React Query Devtools",
|
|
1526
|
+
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
1527
|
+
"aria-haspopup": "true",
|
|
1528
|
+
"aria-expanded": "false",
|
|
1529
|
+
onClick: e => {
|
|
1530
|
+
setIsOpen(true);
|
|
1531
|
+
onToggleClick?.(e);
|
|
1532
|
+
},
|
|
1211
1533
|
style: {
|
|
1212
|
-
|
|
1534
|
+
background: 'none',
|
|
1535
|
+
border: 0,
|
|
1213
1536
|
padding: 0,
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
borderRadius: '0.4em',
|
|
1220
|
-
fontWeight: 'bold',
|
|
1221
|
-
textShadow: '0 2px 10px black',
|
|
1222
|
-
background: getQueryStatusColor({
|
|
1223
|
-
queryState: activeQueryState,
|
|
1224
|
-
isStale: isStale,
|
|
1225
|
-
observerCount: observerCount,
|
|
1226
|
-
theme: defaultTheme
|
|
1227
|
-
}),
|
|
1228
|
-
flexShrink: 0
|
|
1229
|
-
}
|
|
1230
|
-
}, getQueryStatusLabel(activeQuery))), /*#__PURE__*/React.createElement("div", {
|
|
1231
|
-
style: {
|
|
1232
|
-
marginBottom: '.5em',
|
|
1233
|
-
display: 'flex',
|
|
1234
|
-
alignItems: 'center',
|
|
1235
|
-
justifyContent: 'space-between'
|
|
1236
|
-
}
|
|
1237
|
-
}, "Observers: ", /*#__PURE__*/React.createElement(Code, null, observerCount)), /*#__PURE__*/React.createElement("div", {
|
|
1238
|
-
style: {
|
|
1239
|
-
display: 'flex',
|
|
1240
|
-
alignItems: 'center',
|
|
1241
|
-
justifyContent: 'space-between'
|
|
1242
|
-
}
|
|
1243
|
-
}, "Last Updated:", ' ', /*#__PURE__*/React.createElement(Code, null, new Date(activeQueryState.dataUpdatedAt).toLocaleTimeString()))), /*#__PURE__*/React.createElement("div", {
|
|
1244
|
-
style: {
|
|
1245
|
-
background: defaultTheme.backgroundAlt,
|
|
1246
|
-
padding: '.5em',
|
|
1247
|
-
position: 'sticky',
|
|
1248
|
-
top: 0,
|
|
1249
|
-
zIndex: 1
|
|
1250
|
-
}
|
|
1251
|
-
}, "Actions"), /*#__PURE__*/React.createElement("div", {
|
|
1252
|
-
style: {
|
|
1253
|
-
padding: '0.5em'
|
|
1254
|
-
}
|
|
1255
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
1256
|
-
type: "button",
|
|
1257
|
-
onClick: handleRefetch,
|
|
1258
|
-
disabled: activeQueryState.fetchStatus === 'fetching',
|
|
1259
|
-
style: {
|
|
1260
|
-
background: defaultTheme.active
|
|
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
|
|
1347
|
-
}
|
|
1348
|
-
}, "stale ", /*#__PURE__*/React.createElement(Code, null, "(", hasStale, ")")), ' ', /*#__PURE__*/React.createElement(QueryKey, {
|
|
1349
|
-
style: {
|
|
1350
|
-
background: defaultTheme.gray,
|
|
1351
|
-
opacity: hasInactive ? 1 : 0.3
|
|
1352
|
-
}
|
|
1353
|
-
}, "inactive ", /*#__PURE__*/React.createElement(Code, null, "(", hasInactive, ")")));
|
|
1354
|
-
};
|
|
1355
|
-
const QueryRow = /*#__PURE__*/React.memo(({
|
|
1356
|
-
queryKey,
|
|
1357
|
-
setActiveQueryHash,
|
|
1358
|
-
activeQueryHash,
|
|
1359
|
-
queryCache
|
|
1360
|
-
}) => {
|
|
1361
|
-
const queryHash = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1362
|
-
queryKey
|
|
1363
|
-
})?.queryHash) ?? '';
|
|
1364
|
-
const queryState = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1365
|
-
queryKey
|
|
1366
|
-
})?.state);
|
|
1367
|
-
const isStale = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1368
|
-
queryKey
|
|
1369
|
-
})?.isStale()) ?? false;
|
|
1370
|
-
const isDisabled = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1371
|
-
queryKey
|
|
1372
|
-
})?.isDisabled()) ?? false;
|
|
1373
|
-
const observerCount = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
1374
|
-
queryKey
|
|
1375
|
-
})?.getObserversCount()) ?? 0;
|
|
1376
|
-
if (!queryState) {
|
|
1377
|
-
return null;
|
|
1378
|
-
}
|
|
1379
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1380
|
-
role: "button",
|
|
1381
|
-
"aria-label": `Open query details for ${queryHash}`,
|
|
1382
|
-
onClick: () => setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash),
|
|
1383
|
-
style: {
|
|
1384
|
-
display: 'flex',
|
|
1385
|
-
borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
|
|
1537
|
+
position: 'fixed',
|
|
1538
|
+
zIndex: 99999,
|
|
1539
|
+
display: 'inline-flex',
|
|
1540
|
+
fontSize: '1.5em',
|
|
1541
|
+
margin: '.5em',
|
|
1386
1542
|
cursor: 'pointer',
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1543
|
+
width: 'fit-content',
|
|
1544
|
+
...(position === 'top-right' ? {
|
|
1545
|
+
top: '0',
|
|
1546
|
+
right: '0'
|
|
1547
|
+
} : position === 'top-left' ? {
|
|
1548
|
+
top: '0',
|
|
1549
|
+
left: '0'
|
|
1550
|
+
} : position === 'bottom-right' ? {
|
|
1551
|
+
bottom: '0',
|
|
1552
|
+
right: '0'
|
|
1553
|
+
} : {
|
|
1554
|
+
bottom: '0',
|
|
1555
|
+
left: '0'
|
|
1399
1556
|
}),
|
|
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'
|
|
1557
|
+
...toggleButtonStyle
|
|
1420
1558
|
}
|
|
1421
|
-
},
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1559
|
+
}), /*#__PURE__*/React.createElement(Logo, {
|
|
1560
|
+
"aria-hidden": true
|
|
1561
|
+
}), /*#__PURE__*/React.createElement(ScreenReader, {
|
|
1562
|
+
text: "Open React Query Devtools"
|
|
1563
|
+
})) : null);
|
|
1564
|
+
}
|
|
1426
1565
|
|
|
1427
1566
|
const ReactQueryDevtools = ReactQueryDevtools$1;
|
|
1428
|
-
const ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel$
|
|
1567
|
+
const ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel$2;
|
|
1429
1568
|
|
|
1430
1569
|
export { ReactQueryDevtools, ReactQueryDevtoolsPanel };
|
|
1431
1570
|
//# sourceMappingURL=index.prod.mjs.map
|