TypeScript
fix(web): show device diagnostics before hub readiness (#15435)
maria5318d054a5ea
diff --git a/apps/web/src/components/device/DeviceSetup.tsx b/apps/web/src/components/device/DeviceSetup.tsxindex f7869bcd6af..d4ebfe89f90 100644--- a/apps/web/src/components/device/DeviceSetup.tsx+++ b/apps/web/src/components/device/DeviceSetup.tsx@@ -63,6 +63,9 @@ export function DeviceSetup(props: {const [step, setStep] = useState(0);const enabled = props.state.hostStatus !== "disabled";const busy = props.state.hostStatus === "installing" || props.state.hostStatus === "starting";+ const localPlatformsUnavailable = props.state.hosts.some(+ (host) => host.kind === "local" && !host.platforms.some((platform) => platform.available),+ );const update = async (kind: NonNullable<typeof pending>,@@ -117,8 +120,8 @@ export function DeviceSetup(props: {</section>) : null}- {step === 1 ? (- <section className="space-y-3 text-sm">+ {step === 1 || (step === 0 && enabled && localPlatformsUnavailable) ? (+ <section className={cn("space-y-3 text-sm", step === 0 && "mt-4")}><h3 className="font-medium">Check simulator support</h3><DevicePlatformSetupstate={props.state}diff --git a/apps/web/src/components/settings/IntegrationsSettings.tsx b/apps/web/src/components/settings/IntegrationsSettings.tsxindex f77cfcc2576..f9dfb47c5f9 100644--- a/apps/web/src/components/settings/IntegrationsSettings.tsx+++ b/apps/web/src/components/settings/IntegrationsSettings.tsx@@ -646,10 +646,18 @@ function DeviceIntegrationControls({"hub" | "check" | "agent" | "update-hub" | "update-agent" | null>(null);const busy = state.hostStatus === "installing" || state.hostStatus === "starting";+ const localPlatformsUnavailable = state.hosts.some(+ (host) => host.kind === "local" && !host.platforms.some((platform) => platform.available),+ );const [platformsRevealed, setPlatformsRevealed] = useState(false);// Keep diagnostics visible through subsequent agent setup and refresh phases.if (platformsRevealed && !enabled) setPlatformsRevealed(false);- if (enabled && !platformsRevealed && state.hostStatus === "ready" && pending !== "hub") {+ if (+ enabled &&+ !platformsRevealed &&+ (state.hostStatus === "ready" || localPlatformsUnavailable) &&+ pending !== "hub"+ ) {setPlatformsRevealed(true);}