Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc1bc37

Browse files
authored
chore: Drop application host call, default to regions for info (#7457)
* chore: Drop application host call, default to regions for info
1 parent2d62cbc commitfc1bc37

File tree

4 files changed

+11
-24
lines changed

4 files changed

+11
-24
lines changed

‎coderd/apidoc/docs.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/workspaceapps.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
// @Tags Applications
2828
// @Success 200 {object} codersdk.AppHostResponse
2929
// @Router /applications/host [get]
30+
// @Deprecated use api/v2/regions and see the primary proxy.
3031
func (api*API)appHost(rw http.ResponseWriter,r*http.Request) {
3132
host:=api.AppHostname
3233
ifhost!=""&&api.AccessURL.Port()!="" {

‎site/src/contexts/ProxyContext.tsx

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import{useQuery}from"@tanstack/react-query"
2-
import{getApplicationsHost,getWorkspaceProxies}from"api/api"
2+
import{getWorkspaceProxies}from"api/api"
33
import{Region}from"api/typesGenerated"
44
import{useDashboard}from"components/Dashboard/DashboardProvider"
55
import{
@@ -70,7 +70,6 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
7070
onSuccess:(resp)=>{
7171
setAndSaveProxy(proxy.selectedProxy,resp.regions)
7272
},
73-
enabled:experimentEnabled,
7473
})
7574

7675
constsetAndSaveProxy=(
@@ -93,35 +92,20 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
9392
setProxy(preferred)
9493
}
9594

96-
// ******************************* //
97-
// ** This code can be removed **
98-
// ** when the experimental is **
99-
// ** dropped ** //
100-
constappHostQueryKey=["get-application-host"]
101-
const{
102-
data:applicationHostResult,
103-
error:appHostError,
104-
isLoading:appHostLoading,
105-
isFetched:appHostFetched,
106-
}=useQuery({
107-
queryKey:appHostQueryKey,
108-
queryFn:getApplicationsHost,
109-
enabled:!experimentEnabled,
110-
})
111-
11295
return(
11396
<ProxyContext.Provider
11497
value={{
11598
proxy:experimentEnabled
11699
?proxy
117100
:{
118-
...getPreferredProxy([]),
119-
preferredWildcardHostname:applicationHostResult?.host||"",
101+
// If the experiment is disabled, then call 'getPreferredProxy' with the regions from
102+
// the api call. The default behavior is to use the `primary` proxy.
103+
...getPreferredProxy(proxiesResp?.regions||[]),
120104
},
121-
proxies:experimentEnabled ?proxiesResp?.regions :[],
122-
isLoading:experimentEnabled ?proxiesLoading :appHostLoading,
123-
isFetched:experimentEnabled ?proxiesFetched :appHostFetched,
124-
error:experimentEnabled ?proxiesError :appHostError,
105+
proxies:proxiesResp?.regions,
106+
isLoading:proxiesLoading,
107+
isFetched:proxiesFetched,
108+
error:proxiesError,
125109
// A function that takes the new proxies and selected proxy and updates
126110
// the state with the appropriate urls.
127111
setProxy:setAndSaveProxy,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp