diff --git a/desktop/src/renderer/src/lib/components/workspace/WorkspaceWizard.svelte b/desktop/src/renderer/src/lib/components/workspace/WorkspaceWizard.svelte index 38bd4e14d..c56d90d3b 100644 --- a/desktop/src/renderer/src/lib/components/workspace/WorkspaceWizard.svelte +++ b/desktop/src/renderer/src/lib/components/workspace/WorkspaceWizard.svelte @@ -469,8 +469,8 @@ function handleProgress(progress: CommandProgress, wsId: string | undefined) { } } -async function handleLaunch() { - if (resolvedIdInvalid || nameConflict) return +async function handleLaunch(isRetry = false) { + if (resolvedIdInvalid || (nameConflict && !isRetry)) return launchRunning = true launchError = "" launchSuccess = false @@ -1243,7 +1243,7 @@ function selectTemplate(t: { name: string; source: string }) { {:else if launchError} - + {/if} diff --git a/desktop/src/renderer/src/lib/components/workspace/WorkspaceWizard.test.ts b/desktop/src/renderer/src/lib/components/workspace/WorkspaceWizard.test.ts index f7b500230..25d3ef178 100644 --- a/desktop/src/renderer/src/lib/components/workspace/WorkspaceWizard.test.ts +++ b/desktop/src/renderer/src/lib/components/workspace/WorkspaceWizard.test.ts @@ -430,6 +430,39 @@ describe("WorkspaceWizard", () => { unmount() }) + it("retries launch even when the failed workspace is already in the store", async () => { + providers.set([makeProvider("docker")]) + const { getByText, queryByText, unmount } = render(WorkspaceWizard, { + props: { open: true }, + }) + await flushAsync() + await advanceToReview(getByText) + + const launchBtn = Array.from( + document.querySelectorAll("button"), + ).find((b) => b.textContent?.trim() === "Launch") as HTMLButtonElement + await fireEvent.click(launchBtn) + await flushAsync() + + progressCallback?.({ + commandId: "cmd-1", + message: "Exit code: 1", + done: true, + } as CommandProgress) + await flushAsync() + + workspaces.set([{ id: "python" }]) + await flushAsync() + + workspaceUp.mockClear() + const retryBtn = queryByText("Retry") as HTMLButtonElement + await fireEvent.click(retryBtn) + await flushAsync() + + expect(workspaceUp).toHaveBeenCalledTimes(1) + unmount() + }) + it("forwards assembled source plus workspaceFolder and build flags to workspaceUp", async () => { providers.set([makeProvider("docker")]) const { getByText, unmount } = render(WorkspaceWizard, {