File tree 2 files changed +10
-10
lines changed
2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -192,8 +192,11 @@ const ProxyMenu: FC<{ proxyContextValue: ProxyContextValue }> = ({
192
192
const refreshLatencies = proxyContextValue . refetchProxyLatencies
193
193
const closeMenu = ( ) => setIsOpen ( false )
194
194
const navigate = useNavigate ( )
195
+ const latencies = proxyContextValue . proxyLatencies
196
+ const isLoadingLatencies = Object . keys ( latencies ) . length === 0
197
+ const isLoading = proxyContextValue . isLoading || isLoadingLatencies
195
198
196
- if ( ! proxyContextValue . isFetched ) {
199
+ if ( isLoading ) {
197
200
return (
198
201
< Skeleton
199
202
width = "160px"
@@ -230,9 +233,7 @@ const ProxyMenu: FC<{ proxyContextValue: ProxyContextValue }> = ({
230
233
{ selectedProxy . display_name }
231
234
< ProxyStatusLatency
232
235
proxy = { selectedProxy }
233
- latency = {
234
- proxyContextValue . proxyLatencies ?. [ selectedProxy . id ] ?. latencyMS
235
- }
236
+ latency = { latencies ?. [ selectedProxy . id ] ?. latencyMS }
236
237
/>
237
238
</ Box >
238
239
) : (
@@ -278,9 +279,7 @@ const ProxyMenu: FC<{ proxyContextValue: ProxyContextValue }> = ({
278
279
{ proxy . display_name }
279
280
< ProxyStatusLatency
280
281
proxy = { proxy }
281
- latency = {
282
- proxyContextValue . proxyLatencies ?. [ proxy . id ] ?. latencyMS
283
- }
282
+ latency = { latencies ?. [ proxy . id ] ?. latencyMS }
284
283
/>
285
284
</ Box >
286
285
</ MenuItem >
Original file line number Diff line number Diff line change @@ -24,9 +24,10 @@ const proxyLatenciesReducer = (
24
24
state : Record < string , ProxyLatencyReport > ,
25
25
action : ProxyLatencyAction ,
26
26
) : Record < string , ProxyLatencyReport > => {
27
- // Just overwrite any existing latency.
28
- state [ action . proxyID ] = action . report
29
- return state
27
+ return {
28
+ ...state ,
29
+ [ action . proxyID ] : action . report ,
30
+ }
30
31
}
31
32
32
33
export const useProxyLatency = (
You can’t perform that action at this time.
0 commit comments