File tree 7 files changed +23
-1
lines changed
7 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ const Template: Story<AppLinkProps> = (args) => (
29
29
clearProxy : ( ) => {
30
30
return
31
31
} ,
32
+ refetchProxyLatencies : ( ) => {
33
+ return
34
+ } ,
32
35
} }
33
36
>
34
37
< AppLink { ...args } />
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ const proxyContextValue: ProxyContextValue = {
19
19
isFetched : true ,
20
20
setProxy : jest . fn ( ) ,
21
21
clearProxy : action ( "clearProxy" ) ,
22
+ refetchProxyLatencies : jest . fn ( ) ,
22
23
proxyLatencies : { } ,
23
24
}
24
25
Original file line number Diff line number Diff line change @@ -68,6 +68,9 @@ const TemplateFC = (
68
68
clearProxy : ( ) => {
69
69
return
70
70
} ,
71
+ refetchProxyLatencies : ( ) => {
72
+ return
73
+ } ,
71
74
} }
72
75
>
73
76
< AgentRow { ...args } />
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ Example.args = {
33
33
clearProxy : ( ) => {
34
34
return
35
35
} ,
36
+ refetchProxyLatencies : ( ) => {
37
+ return
38
+ } ,
36
39
} }
37
40
>
38
41
< AgentRow
@@ -103,6 +106,9 @@ BunchOfMetadata.args = {
103
106
clearProxy : ( ) => {
104
107
return
105
108
} ,
109
+ refetchProxyLatencies : ( ) => {
110
+ return
111
+ } ,
106
112
} }
107
113
>
108
114
< AgentRow
Original file line number Diff line number Diff line change @@ -53,6 +53,9 @@ const Template: Story<WorkspaceProps> = (args) => (
53
53
setProxy : ( ) => {
54
54
return
55
55
} ,
56
+ refetchProxyLatencies : ( ) => {
57
+ return
58
+ } ,
56
59
} }
57
60
>
58
61
< Workspace { ...args } />
Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ export interface ProxyContextValue {
45
45
// then the latency has not been fetched yet. Calculations happen async for each proxy in the list.
46
46
// Refer to the returned report for a given proxy for more information.
47
47
proxyLatencies : Record < string , ProxyLatencyReport >
48
+ // refetchProxyLatencies will trigger refreshing of the proxy latencies. By default the latencies
49
+ // are loaded once.
50
+ refetchProxyLatencies : ( ) => void
48
51
// setProxy is a function that sets the user's selected proxy. This function should
49
52
// only be called if the user is manually selecting a proxy. This value is stored in local
50
53
// storage and will persist across reloads and tabs.
@@ -101,7 +104,8 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
101
104
102
105
// Every time we get a new proxiesResponse, update the latency check
103
106
// to each workspace proxy.
104
- const { proxyLatencies } = useProxyLatency ( proxiesResp )
107
+ const { proxyLatencies, refetch : refetchProxyLatencies } =
108
+ useProxyLatency ( proxiesResp )
105
109
106
110
// updateProxy is a helper function that when called will
107
111
// update the proxy being used.
@@ -128,6 +132,7 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
128
132
< ProxyContext . Provider
129
133
value = { {
130
134
proxyLatencies,
135
+ refetchProxyLatencies,
131
136
userProxy : userSavedProxy ,
132
137
proxy : experimentEnabled
133
138
? proxy
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ const renderTerminal = () => {
55
55
isLoading : false ,
56
56
setProxy : jest . fn ( ) ,
57
57
clearProxy : jest . fn ( ) ,
58
+ refetchProxyLatencies : jest . fn ( ) ,
58
59
} }
59
60
>
60
61
< TerminalPage renderer = "dom" />
You can’t perform that action at this time.
0 commit comments