From 1d383519dd1d1ae90b6e061e21d729eaffcc63ad Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Wed, 21 Oct 2026 18:56:12 +0700 Subject: [PATCH] feat(app): always show the host picker with Add host on New workspace (#7580) The Host field used to render only with two or more hosts, and Add host only appeared on compact layouts. Single-host users had no sign that Paseo can drive other machines from this screen. The field now always renders and its menu always ends with Add host. --- .../app/e2e/browser/new-workspace-entry.spec.ts | 9 +++++++-- .../app/src/screens/new-workspace/form/index.tsx | 13 +++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/app/e2e/browser/new-workspace-entry.spec.ts b/packages/app/e2e/browser/new-workspace-entry.spec.ts index e6c788a8f4..3f1710b918 100644 --- a/packages/app/e2e/browser/new-workspace-entry.spec.ts +++ b/packages/app/e2e/browser/new-workspace-entry.spec.ts @@ -95,7 +95,7 @@ test.describe("New workspace entry points", () => { } }); - test("the New Workspace screen hides the host selector when there is only one host", async ({ + test("the New Workspace screen shows the host selector with Add host when there is only one host", async ({ page, }) => { const seeded: SeededWorkspace = await seedWorkspace({ repoPrefix: "entry-single-host-" }); @@ -120,7 +120,12 @@ test.describe("New workspace entry points", () => { await expect(page.getByTestId("new-workspace-project-picker-trigger")).toBeVisible({ timeout: 30_000, }); - await expect(page.getByTestId("host-picker-trigger")).toHaveCount(0); + const hostTrigger = page.getByTestId("host-picker-trigger"); + await expect(hostTrigger).toContainText("localhost", { timeout: 30_000 }); + await hostTrigger.click(); + await expect(page.getByTestId("new-workspace-host-picker-add-host")).toBeVisible(); + await page.getByTestId("new-workspace-host-picker-add-host").click(); + await expect(page).toHaveURL(/\/settings\/general\?addHost=/); } finally { await seeded.cleanup(); } diff --git a/packages/app/src/screens/new-workspace/form/index.tsx b/packages/app/src/screens/new-workspace/form/index.tsx index d05adb2e61..c1cf1e2482 100644 --- a/packages/app/src/screens/new-workspace/form/index.tsx +++ b/packages/app/src/screens/new-workspace/form/index.tsx @@ -160,7 +160,8 @@ function useRefRenderOption(itemById: Map, isPending: boolea /** * The New workspace setup fields, one trigger per field, each opening its picker. Compact: a stack * of full-width fields with the label inside. Desktop: one meta row of badges. Either way, a field - * that does not apply to the selected project is left out, and Host only shows with a second host. + * that does not apply to the selected project is left out. Host always shows, even with one host, so + * its Add host action keeps multi-host discoverable. */ export function useNewWorkspaceForm(props: NewWorkspaceFormProps): ReactElement { const { t } = useTranslation(); @@ -170,7 +171,6 @@ export function useNewWorkspaceForm(props: NewWorkspaceFormProps): ReactElement const isolationPicker = useIsolationPicker(isolation, isPending); const renderRefOption = useRefRenderOption(base.itemById, isPending); - const showHost = host.allHosts.length > 1; const selectedHostLabel = host.allHosts.find((h) => h.serverId === host.selectedServerId)?.label ?? "Host"; const selectedProject = project.selectedProject; @@ -214,7 +214,7 @@ export function useNewWorkspaceForm(props: NewWorkspaceFormProps): ReactElement testID="new-workspace-project-picker-trigger" /> ); - const hostField = showHost ? ( + const hostField = ( - ) : null; + ); const isolationField = isolation.canCreateWorktree ? ( {projectField} - {hostField ? {hostField} : null} + {hostField} {isolationField ? {isolationField} : null} {baseField ? {baseField} : null}