@tanstack/react-query-devtools 4.13.4 → 4.13.6
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/devtools.esm.js +2 -3
- package/build/lib/devtools.esm.js.map +1 -1
- package/build/lib/devtools.js +2 -3
- package/build/lib/devtools.js.map +1 -1
- package/build/lib/devtools.mjs +2 -3
- package/build/lib/devtools.mjs.map +1 -1
- package/build/lib/index.prod.esm.js +2 -3
- package/build/lib/index.prod.esm.js.map +1 -1
- package/build/lib/index.prod.js +2 -3
- package/build/lib/index.prod.js.map +1 -1
- package/build/lib/index.prod.mjs +2 -3
- package/build/lib/index.prod.mjs.map +1 -1
- package/build/umd/index.development.js +2 -3
- package/build/umd/index.development.js.map +1 -1
- package/package.json +3 -3
- package/src/devtools.tsx +82 -80
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-query-devtools",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.6",
|
|
4
4
|
"description": "Developer tools to interact with and visualize the TanStack/react-query cache",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"react-dom": "^18.2.0",
|
|
47
47
|
"react-dom-17": "npm:react-dom@^17.0.2",
|
|
48
48
|
"react-error-boundary": "^3.1.4",
|
|
49
|
-
"@tanstack/react-query": "4.13.
|
|
49
|
+
"@tanstack/react-query": "4.13.5"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@tanstack/match-sorter-utils": "^8.1.1",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
58
58
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
59
|
-
"@tanstack/react-query": "4.13.
|
|
59
|
+
"@tanstack/react-query": "4.13.5"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"clean": "rm -rf ./build",
|
package/src/devtools.tsx
CHANGED
|
@@ -1081,103 +1081,105 @@ interface QueryRowProps {
|
|
|
1081
1081
|
queryCache: QueryCache
|
|
1082
1082
|
}
|
|
1083
1083
|
|
|
1084
|
-
const QueryRow = (
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
}: QueryRowProps) => {
|
|
1090
|
-
const queryHash =
|
|
1091
|
-
useSubscribeToQueryCache(
|
|
1092
|
-
queryCache,
|
|
1093
|
-
() => queryCache.find(queryKey)?.queryHash,
|
|
1094
|
-
) ?? ''
|
|
1095
|
-
|
|
1096
|
-
const queryState = useSubscribeToQueryCache(
|
|
1084
|
+
const QueryRow = React.memo(
|
|
1085
|
+
({
|
|
1086
|
+
queryKey,
|
|
1087
|
+
setActiveQueryHash,
|
|
1088
|
+
activeQueryHash,
|
|
1097
1089
|
queryCache,
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1090
|
+
}: QueryRowProps) => {
|
|
1091
|
+
const queryHash =
|
|
1092
|
+
useSubscribeToQueryCache(
|
|
1093
|
+
queryCache,
|
|
1094
|
+
() => queryCache.find(queryKey)?.queryHash,
|
|
1095
|
+
) ?? ''
|
|
1096
|
+
|
|
1097
|
+
const queryState = useSubscribeToQueryCache(
|
|
1098
|
+
queryCache,
|
|
1099
|
+
() => queryCache.find(queryKey)?.state,
|
|
1100
|
+
)
|
|
1101
|
+
|
|
1102
|
+
const isStale =
|
|
1103
|
+
useSubscribeToQueryCache(queryCache, () =>
|
|
1104
|
+
queryCache.find(queryKey)?.isStale(),
|
|
1105
|
+
) ?? false
|
|
1106
|
+
|
|
1107
|
+
const isDisabled =
|
|
1108
|
+
useSubscribeToQueryCache(queryCache, () =>
|
|
1109
|
+
queryCache.find(queryKey)?.isDisabled(),
|
|
1110
|
+
) ?? false
|
|
1111
|
+
|
|
1112
|
+
const observerCount =
|
|
1113
|
+
useSubscribeToQueryCache(queryCache, () =>
|
|
1114
|
+
queryCache.find(queryKey)?.getObserversCount(),
|
|
1115
|
+
) ?? 0
|
|
1116
|
+
|
|
1117
|
+
if (!queryState) {
|
|
1118
|
+
return null
|
|
1119
|
+
}
|
|
1119
1120
|
|
|
1120
|
-
|
|
1121
|
-
<div
|
|
1122
|
-
role="button"
|
|
1123
|
-
aria-label={`Open query details for ${queryHash}`}
|
|
1124
|
-
onClick={() =>
|
|
1125
|
-
setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash)
|
|
1126
|
-
}
|
|
1127
|
-
style={{
|
|
1128
|
-
display: 'flex',
|
|
1129
|
-
borderBottom: `solid 1px ${theme.grayAlt}`,
|
|
1130
|
-
cursor: 'pointer',
|
|
1131
|
-
background:
|
|
1132
|
-
queryHash === activeQueryHash ? 'rgba(255,255,255,.1)' : undefined,
|
|
1133
|
-
}}
|
|
1134
|
-
>
|
|
1121
|
+
return (
|
|
1135
1122
|
<div
|
|
1123
|
+
role="button"
|
|
1124
|
+
aria-label={`Open query details for ${queryHash}`}
|
|
1125
|
+
onClick={() =>
|
|
1126
|
+
setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash)
|
|
1127
|
+
}
|
|
1136
1128
|
style={{
|
|
1137
|
-
flex: '0 0 auto',
|
|
1138
|
-
width: '2em',
|
|
1139
|
-
height: '2em',
|
|
1140
|
-
background: getQueryStatusColor({
|
|
1141
|
-
queryState,
|
|
1142
|
-
isStale,
|
|
1143
|
-
observerCount,
|
|
1144
|
-
theme,
|
|
1145
|
-
}),
|
|
1146
1129
|
display: 'flex',
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
color: isStale ? 'black' : 'white',
|
|
1130
|
+
borderBottom: `solid 1px ${theme.grayAlt}`,
|
|
1131
|
+
cursor: 'pointer',
|
|
1132
|
+
background:
|
|
1133
|
+
queryHash === activeQueryHash ? 'rgba(255,255,255,.1)' : undefined,
|
|
1152
1134
|
}}
|
|
1153
1135
|
>
|
|
1154
|
-
{observerCount}
|
|
1155
|
-
</div>
|
|
1156
|
-
{isDisabled ? (
|
|
1157
1136
|
<div
|
|
1158
1137
|
style={{
|
|
1159
1138
|
flex: '0 0 auto',
|
|
1139
|
+
width: '2em',
|
|
1160
1140
|
height: '2em',
|
|
1161
|
-
background:
|
|
1141
|
+
background: getQueryStatusColor({
|
|
1142
|
+
queryState,
|
|
1143
|
+
isStale,
|
|
1144
|
+
observerCount,
|
|
1145
|
+
theme,
|
|
1146
|
+
}),
|
|
1162
1147
|
display: 'flex',
|
|
1163
1148
|
alignItems: 'center',
|
|
1149
|
+
justifyContent: 'center',
|
|
1164
1150
|
fontWeight: 'bold',
|
|
1165
|
-
|
|
1151
|
+
textShadow: isStale ? '0' : '0 0 10px black',
|
|
1152
|
+
color: isStale ? 'black' : 'white',
|
|
1166
1153
|
}}
|
|
1167
1154
|
>
|
|
1168
|
-
|
|
1155
|
+
{observerCount}
|
|
1169
1156
|
</div>
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
}
|
|
1157
|
+
{isDisabled ? (
|
|
1158
|
+
<div
|
|
1159
|
+
style={{
|
|
1160
|
+
flex: '0 0 auto',
|
|
1161
|
+
height: '2em',
|
|
1162
|
+
background: theme.gray,
|
|
1163
|
+
display: 'flex',
|
|
1164
|
+
alignItems: 'center',
|
|
1165
|
+
fontWeight: 'bold',
|
|
1166
|
+
padding: '0 0.5em',
|
|
1167
|
+
}}
|
|
1168
|
+
>
|
|
1169
|
+
disabled
|
|
1170
|
+
</div>
|
|
1171
|
+
) : null}
|
|
1172
|
+
<Code
|
|
1173
|
+
style={{
|
|
1174
|
+
padding: '.5em',
|
|
1175
|
+
}}
|
|
1176
|
+
>
|
|
1177
|
+
{`${queryHash}`}
|
|
1178
|
+
</Code>
|
|
1179
|
+
</div>
|
|
1180
|
+
)
|
|
1181
|
+
},
|
|
1182
|
+
)
|
|
1181
1183
|
|
|
1182
1184
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1183
1185
|
function noop() {}
|