TypeScript
fix(web): stop mistaking offline servers for updates (#13083)
Tristan Knightdd582dee3697
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsxindex 3262ff9cc4a..61f1770c4be 100644--- a/apps/web/src/components/ChatView.tsx+++ b/apps/web/src/components/ChatView.tsx@@ -2705,68 +2705,40 @@ export default function ChatView(props: ChatViewProps) {unavailableConnection !== null &&(unavailableConnection.phase === "connecting" ||unavailableConnection.phase === "reconnecting");- // Reconnecting to a version-skewed server with no update in flight- // usually means the server is restarting mid-update and a refresh wiped- // the in-memory update state. Fold the reconnect and version banners- // into one calm line instead of stacking "Failed to connect" on- // "versions differ". A failed update never folds: its error and retry- // action must stay visible.- const reconnectingThroughVersionSkew =- serverUpdateState.status === "idle" && environmentReconnecting && versionMismatch !== null;// While an update runs, transient connect blips are expected (the server// restarts) and the update banner already shows progress. Hard failure// phases still surface so the Reconnect action stays reachable.const suppressUnavailableBanner =- environmentReconnecting &&- (updateRunning || (!reconnectingThroughVersionSkew && !reconnectWarningGraceElapsed));+ environmentReconnecting && (updateRunning || !reconnectWarningGraceElapsed);if (activeEnvironmentUnavailableState && unavailableConnection && !suppressUnavailableBanner) {- if (reconnectingThroughVersionSkew) {- items.push({- id: `environment-unavailable:${activeEnvironmentUnavailableState.environmentId}`,- variant: "default",- // Prioritize live connection progress among the notices.- priority: "urgent",- icon: (- <span- className="size-1.5 animate-status-pulse rounded-full bg-foreground"- aria-hidden="true"- />- ),- title: `${unavailableConnection.phase === "connecting" ? "Connecting" : "Reconnecting"} to ${activeEnvironmentUnavailableState.label}`,- description: "Finishing an update",- actions: disconnectAction,- });- } else {- items.push({- id: `environment-unavailable:${activeEnvironmentUnavailableState.environmentId}`,- variant: unavailableConnection.phase === "error" ? "error" : "warning",- icon: <WifiOffIcon />,- title: `${activeEnvironmentUnavailableState.label} is ${environmentReconnecting ? "reconnecting" : "offline"}`,- actions: (- <>- {!environmentReconnecting ? (- <Button- size="xs"- variant="ghost"- onClick={() =>- void handleReconnectActiveEnvironment(- activeEnvironmentUnavailableState.environmentId,- )- }- >- Reconnect- </Button>- ) : null}- {disconnectAction}- </>- ),- });- }+ items.push({+ id: `environment-unavailable:${activeEnvironmentUnavailableState.environmentId}`,+ variant: unavailableConnection.phase === "error" ? "error" : "warning",+ icon: <WifiOffIcon />,+ title: `${activeEnvironmentUnavailableState.label} is ${environmentReconnecting ? "reconnecting" : "offline"}`,+ actions: (+ <>+ {!environmentReconnecting ? (+ <Button+ size="xs"+ variant="ghost"+ onClick={() =>+ void handleReconnectActiveEnvironment(+ activeEnvironmentUnavailableState.environmentId,+ )+ }+ >+ Reconnect+ </Button>+ ) : null}+ {disconnectAction}+ </>+ ),+ });}if (!automaticEnvironment &&serverUpdateEnvironmentId &&- !reconnectingThroughVersionSkew &&(serverUpdateState.status === "idle"? showVersionMismatchBanner: !serverUpdateFailureDismissed)