fix: Prioritize polled preview status over mutation pending state

The startPreview mutation blocks server-side through the entire Docker
build + health check + seed cycle. isPending was checked first, so even
after polling detected containers running, the UI stayed on "Building..."
until the full mutation resolved. Now polled status (running/failed)
takes priority, falling back to isPending only when no status exists.
This commit is contained in:
Lukas May
2026-03-05 21:58:02 +01:00
parent 4958b6624d
commit df84a877f2
2 changed files with 12 additions and 16 deletions

View File

@@ -129,15 +129,13 @@ export function InitiativeReview({ initiativeId, onCompleted }: InitiativeReview
const previewState = firstProjectId && sourceBranch const previewState = firstProjectId && sourceBranch
? { ? {
status: startPreview.isPending status: preview?.status === "running"
? ("building" as const) ? ("running" as const)
: preview?.status === "running" : preview?.status === "failed"
? ("running" as const) ? ("failed" as const)
: preview?.status === "building" : (startPreview.isPending || preview?.status === "building")
? ("building" as const) ? ("building" as const)
: preview?.status === "failed" : ("idle" as const),
? ("failed" as const)
: ("idle" as const),
url: preview?.url ?? undefined, url: preview?.url ?? undefined,
onStart: () => onStart: () =>
startPreview.mutate({ startPreview.mutate({

View File

@@ -116,15 +116,13 @@ export function ReviewTab({ initiativeId }: ReviewTabProps) {
const previewState = firstProjectId && sourceBranch const previewState = firstProjectId && sourceBranch
? { ? {
status: startPreview.isPending status: preview?.status === "running"
? ("building" as const) ? ("running" as const)
: preview?.status === "running" : preview?.status === "failed"
? ("running" as const) ? ("failed" as const)
: preview?.status === "building" : (startPreview.isPending || preview?.status === "building")
? ("building" as const) ? ("building" as const)
: preview?.status === "failed" : ("idle" as const),
? ("failed" as const)
: ("idle" as const),
url: preview?.url ?? undefined, url: preview?.url ?? undefined,
onStart: () => onStart: () =>
startPreview.mutate({ startPreview.mutate({