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:
@@ -129,15 +129,13 @@ export function InitiativeReview({ initiativeId, onCompleted }: InitiativeReview
|
||||
|
||||
const previewState = firstProjectId && sourceBranch
|
||||
? {
|
||||
status: startPreview.isPending
|
||||
? ("building" as const)
|
||||
: preview?.status === "running"
|
||||
? ("running" as const)
|
||||
: preview?.status === "building"
|
||||
status: preview?.status === "running"
|
||||
? ("running" as const)
|
||||
: preview?.status === "failed"
|
||||
? ("failed" as const)
|
||||
: (startPreview.isPending || preview?.status === "building")
|
||||
? ("building" as const)
|
||||
: preview?.status === "failed"
|
||||
? ("failed" as const)
|
||||
: ("idle" as const),
|
||||
: ("idle" as const),
|
||||
url: preview?.url ?? undefined,
|
||||
onStart: () =>
|
||||
startPreview.mutate({
|
||||
|
||||
@@ -116,15 +116,13 @@ export function ReviewTab({ initiativeId }: ReviewTabProps) {
|
||||
|
||||
const previewState = firstProjectId && sourceBranch
|
||||
? {
|
||||
status: startPreview.isPending
|
||||
? ("building" as const)
|
||||
: preview?.status === "running"
|
||||
? ("running" as const)
|
||||
: preview?.status === "building"
|
||||
status: preview?.status === "running"
|
||||
? ("running" as const)
|
||||
: preview?.status === "failed"
|
||||
? ("failed" as const)
|
||||
: (startPreview.isPending || preview?.status === "building")
|
||||
? ("building" as const)
|
||||
: preview?.status === "failed"
|
||||
? ("failed" as const)
|
||||
: ("idle" as const),
|
||||
: ("idle" as const),
|
||||
url: preview?.url ?? undefined,
|
||||
onStart: () =>
|
||||
startPreview.mutate({
|
||||
|
||||
Reference in New Issue
Block a user