File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 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 }> = ({
192192 const refreshLatencies = proxyContextValue . refetchProxyLatencies
193193 const closeMenu = ( ) => setIsOpen ( false )
194194 const navigate = useNavigate ( )
195+ const latencies = proxyContextValue . proxyLatencies
196+ const isLoadingLatencies = Object . keys ( latencies ) . length === 0
197+ const isLoading = proxyContextValue . isLoading || isLoadingLatencies
195198
196- if ( ! proxyContextValue . isFetched ) {
199+ if ( isLoading ) {
197200 return (
198201 < Skeleton
199202 width = "160px"
@@ -230,9 +233,7 @@ const ProxyMenu: FC<{ proxyContextValue: ProxyContextValue }> = ({
230233 { selectedProxy . display_name }
231234 < ProxyStatusLatency
232235 proxy = { selectedProxy }
233- latency = {
234- proxyContextValue . proxyLatencies ?. [ selectedProxy . id ] ?. latencyMS
235- }
236+ latency = { latencies ?. [ selectedProxy . id ] ?. latencyMS }
236237 />
237238 </ Box >
238239 ) : (
@@ -278,9 +279,7 @@ const ProxyMenu: FC<{ proxyContextValue: ProxyContextValue }> = ({
278279 { proxy . display_name }
279280 < ProxyStatusLatency
280281 proxy = { proxy }
281- latency = {
282- proxyContextValue . proxyLatencies ?. [ proxy . id ] ?. latencyMS
283- }
282+ latency = { latencies ?. [ proxy . id ] ?. latencyMS }
284283 />
285284 </ Box >
286285 </ MenuItem >
Original file line number Diff line number Diff line change @@ -24,9 +24,10 @@ const proxyLatenciesReducer = (
2424 state : Record < string , ProxyLatencyReport > ,
2525 action : ProxyLatencyAction ,
2626) : 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+ }
3031}
3132
3233export const useProxyLatency = (
You can’t perform that action at this time.
0 commit comments