Skip to content

Commit f18dcd4

Browse files
fix(pro): url host
1 parent 79864ec commit f18dcd4

File tree

6 files changed

+521
-205
lines changed

6 files changed

+521
-205
lines changed

desktop/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@
6868
"@types/uuid": "9.0.5",
6969
"@typescript-eslint/eslint-plugin": "5.59.11",
7070
"@typescript-eslint/parser": "5.59.11",
71-
"@vitejs/plugin-react": "4.1.0",
71+
"@vitejs/plugin-react": "4.3.4",
7272
"eslint": "8.44.0",
7373
"eslint-config-prettier": "8.8.0",
7474
"eslint-config-react-app": "7.0.1",
7575
"eslint-plugin-react": "7.34.1",
7676
"eslint-plugin-react-hooks": "4.6.0",
7777
"prettier": "3.0.3",
7878
"typescript": "5.0.4",
79-
"vite": "4.4.9"
79+
"vite": "6.2.0"
8080
},
8181
"resolutions": {
8282
"lodash": "4.17.21"

desktop/src/contexts/DevPodContext/Pro/ContextSwitcher.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export function ContextSwitcher({
145145
) : undefined
146146
}
147147
onClick={() => onProjectChange(project)}>
148-
{getDisplayName(project)}
148+
{getDisplayName(project, "Unknown Project")}
149149
</Button>
150150
</ListItem>
151151
))}

desktop/src/contexts/DevPodContext/Pro/ProProvider.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { ContextSwitcher, HOST_OSS } from "./ContextSwitcher"
1313

1414
type TProContext = Readonly<{
1515
managementSelfQuery: UseQueryResult<ManagementV1Self | undefined>
16-
projectsQuery: UseQueryResult<readonly ManagementV1Project[] | undefined>
1716
currentProject?: ManagementV1Project
1817
host: string
1918
client: ProClient
@@ -118,12 +117,11 @@ export function ProProvider({ host, children }: { host: string; children: ReactN
118117
return {
119118
managementSelfQuery,
120119
currentProject,
121-
projectsQuery,
122120
host,
123121
client,
124122
isLoadingWorkspaces,
125123
}
126-
}, [managementSelfQuery, currentProject, projectsQuery, host, client, isLoadingWorkspaces])
124+
}, [managementSelfQuery, currentProject, host, client, isLoadingWorkspaces])
127125

128126
return (
129127
<ProContext.Provider value={value}>
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
import { useMemo } from "react"
21
import { useParams } from "react-router-dom"
32

43
export function useProHost() {
5-
const { host: urlHost } = useParams<{ host: string | undefined }>()
6-
7-
const host = useMemo(() => {
8-
return urlHost?.replaceAll("-", ".")
9-
}, [urlHost])
4+
const { host } = useParams<{ host: string | undefined }>()
105

116
return host
127
}

desktop/src/routes.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ export const Routes = {
8080
PRO_WORKSPACE_CREATE: "/pro/:host/new",
8181
PRO_SETTINGS: "/pro/:host/settings",
8282
toProInstance(host: string): string {
83-
// This is a workaround for react-routers interaction with hostnames as path components
84-
const h = host.replaceAll(".", "-")
85-
86-
return `/pro/${h}`
83+
return `/pro/${host}`
8784
},
8885
toProWorkspace(host: string, instanceID: string): string {
8986
const base = this.toProInstance(host)

0 commit comments

Comments
 (0)