@@ -300,7 +300,7 @@ const ProxyMenu: FC<{ proxyContextValue: ProxyContextValue }> = ({
300
300
< Typography
301
301
component = "p"
302
302
sx = { {
303
- fontSize : "inherit" ,
303
+ fontSize : 13 ,
304
304
color : ( theme ) => theme . palette . text . secondary ,
305
305
lineHeight : "inherit" ,
306
306
marginTop : 0.5 ,
@@ -311,43 +311,49 @@ const ProxyMenu: FC<{ proxyContextValue: ProxyContextValue }> = ({
311
311
</ Typography >
312
312
</ Box >
313
313
< Divider sx = { { borderColor : ( theme ) => theme . palette . divider } } />
314
- { proxyContextValue . proxies ?. map ( ( proxy ) => (
315
- < MenuItem
316
- onClick = { ( ) => {
317
- if ( ! proxy . healthy ) {
318
- displayError ( "Please select a healthy workspace proxy." )
319
- closeMenu ( )
320
- return
321
- }
314
+ { proxyContextValue . proxies
315
+ ?. sort ( ( a , b ) => {
316
+ const latencyA = latencies ?. [ a . id ] ?. latencyMS ?? Infinity
317
+ const latencyB = latencies ?. [ b . id ] ?. latencyMS ?? Infinity
318
+ return latencyA - latencyB
319
+ } )
320
+ . map ( ( proxy ) => (
321
+ < MenuItem
322
+ onClick = { ( ) => {
323
+ if ( ! proxy . healthy ) {
324
+ displayError ( "Please select a healthy workspace proxy." )
325
+ closeMenu ( )
326
+ return
327
+ }
322
328
323
- proxyContextValue . setProxy ( proxy )
324
- closeMenu ( )
325
- } }
326
- key = { proxy . id }
327
- selected = { proxy . id === selectedProxy ?. id }
328
- sx = { {
329
- fontSize : 14 ,
330
- } }
331
- >
332
- < Box display = "flex" gap = { 3 } alignItems = "center" width = "100%" >
333
- < Box width = { 14 } height = { 14 } lineHeight = { 0 } >
334
- < Box
335
- component = "img"
336
- src = { proxy . icon_url }
337
- alt = ""
338
- sx = { { objectFit : "contain" } }
339
- width = "100%"
340
- height = "100%"
329
+ proxyContextValue . setProxy ( proxy )
330
+ closeMenu ( )
331
+ } }
332
+ key = { proxy . id }
333
+ selected = { proxy . id === selectedProxy ?. id }
334
+ sx = { {
335
+ fontSize : 14 ,
336
+ } }
337
+ >
338
+ < Box display = "flex" gap = { 3 } alignItems = "center" width = "100%" >
339
+ < Box width = { 14 } height = { 14 } lineHeight = { 0 } >
340
+ < Box
341
+ component = "img"
342
+ src = { proxy . icon_url }
343
+ alt = ""
344
+ sx = { { objectFit : "contain" } }
345
+ width = "100%"
346
+ height = "100%"
347
+ />
348
+ </ Box >
349
+ { proxy . display_name }
350
+ < ProxyStatusLatency
351
+ latency = { latencies ?. [ proxy . id ] ?. latencyMS }
352
+ isLoading = { proxyLatencyLoading ( proxy ) }
341
353
/>
342
354
</ Box >
343
- { proxy . display_name }
344
- < ProxyStatusLatency
345
- latency = { latencies ?. [ proxy . id ] ?. latencyMS }
346
- isLoading = { proxyLatencyLoading ( proxy ) }
347
- />
348
- </ Box >
349
- </ MenuItem >
350
- ) ) }
355
+ </ MenuItem >
356
+ ) ) }
351
357
< Divider sx = { { borderColor : ( theme ) => theme . palette . divider } } />
352
358
{ Boolean ( permissions . editWorkspaceProxies ) && (
353
359
< MenuItem
0 commit comments