@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-query-devtools",
3
- "version": "4.13.4",
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.4"
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.4"
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
- queryKey,
1086
- setActiveQueryHash,
1087
- activeQueryHash,
1088
- queryCache,
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
- () => queryCache.find(queryKey)?.state,
1099
- )
1100
-
1101
- const isStale =
1102
- useSubscribeToQueryCache(queryCache, () =>
1103
- queryCache.find(queryKey)?.isStale(),
1104
- ) ?? false
1105
-
1106
- const isDisabled =
1107
- useSubscribeToQueryCache(queryCache, () =>
1108
- queryCache.find(queryKey)?.isDisabled(),
1109
- ) ?? false
1110
-
1111
- const observerCount =
1112
- useSubscribeToQueryCache(queryCache, () =>
1113
- queryCache.find(queryKey)?.getObserversCount(),
1114
- ) ?? 0
1115
-
1116
- if (!queryState) {
1117
- return null
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
- return (
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
- alignItems: 'center',
1148
- justifyContent: 'center',
1149
- fontWeight: 'bold',
1150
- textShadow: isStale ? '0' : '0 0 10px black',
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: theme.gray,
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
- padding: '0 0.5em',
1151
+ textShadow: isStale ? '0' : '0 0 10px black',
1152
+ color: isStale ? 'black' : 'white',
1166
1153
  }}
1167
1154
  >
1168
- disabled
1155
+ {observerCount}
1169
1156
  </div>
1170
- ) : null}
1171
- <Code
1172
- style={{
1173
- padding: '.5em',
1174
- }}
1175
- >
1176
- {`${queryHash}`}
1177
- </Code>
1178
- </div>
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() {}