Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1243,7 +1243,7 @@ function selectTemplate(t: { name: string; source: string }) {
</Button>
{:else if launchError}
<Button variant="outline" onclick={() => (open = false)}>Close</Button>
<Button onclick={handleLaunch}>Retry</Button>
<Button onclick={() => handleLaunch(true)}>Retry</Button>
{/if}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down
Loading