@@ -1081,103 +1081,105 @@ interface QueryRowProps {
10811081 queryCache : QueryCache
10821082}
10831083
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,
10971089 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+ }
11191120
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 (
11351122 < div
1123+ role = "button"
1124+ aria-label = { `Open query details for ${ queryHash } ` }
1125+ onClick = { ( ) =>
1126+ setActiveQueryHash ( activeQueryHash === queryHash ? '' : queryHash )
1127+ }
11361128 style = { {
1137- flex : '0 0 auto' ,
1138- width : '2em' ,
1139- height : '2em' ,
1140- background : getQueryStatusColor ( {
1141- queryState,
1142- isStale,
1143- observerCount,
1144- theme,
1145- } ) ,
11461129 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 ,
11521134 } }
11531135 >
1154- { observerCount }
1155- </ div >
1156- { isDisabled ? (
11571136 < div
11581137 style = { {
11591138 flex : '0 0 auto' ,
1139+ width : '2em' ,
11601140 height : '2em' ,
1161- background : theme . gray ,
1141+ background : getQueryStatusColor ( {
1142+ queryState,
1143+ isStale,
1144+ observerCount,
1145+ theme,
1146+ } ) ,
11621147 display : 'flex' ,
11631148 alignItems : 'center' ,
1149+ justifyContent : 'center' ,
11641150 fontWeight : 'bold' ,
1165- padding : '0 0.5em' ,
1151+ textShadow : isStale ? '0' : '0 0 10px black' ,
1152+ color : isStale ? 'black' : 'white' ,
11661153 } }
11671154 >
1168- disabled
1155+ { observerCount }
11691156 </ 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+ )
11811183
11821184// eslint-disable-next-line @typescript-eslint/no-empty-function
11831185function noop ( ) { }
0 commit comments