From 4ff3279abb3fd3b5d8a64674668262469a02d893 Mon Sep 17 00:00:00 2001 From: James Risbey Date: Thu, 6 Aug 2026 19:28:36 +1000 Subject: [PATCH] fix(desktop): say "Reconnecting" while the client is auto-reconnecting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sidebar relay card renders "Can't reach the relay" / "Click to connect" for every degraded state, including `reconnecting` — the state the relay client sets while its own backoff loop is actively retrying. So a transient drop that the app is already recovering from unassisted is presented as a dead connection the user has to go fix by hand. The card had no way to tell the two apart: it only receives `isReconnectPending`, which tracks a *manual* reconnect the user asked for via `useReconnectRelay`, and is false during the background loop. `ConnectionState` already distinguishes `reconnecting` from `disconnected`/`stalled`; the card just never saw it. Thread that through as `isAutoReconnecting` and use it for the no-user-action-needed case only: reconnecting -> "Reconnecting" + spinner, role=status disconnected / stalled -> unchanged alarm copy, role=alert The action button stays enabled while auto-reconnecting so anyone who does not want to wait out the backoff can still force an attempt. `stalled` deliberately keeps the alarm copy: the socket is open but no frames are arriving, so the client is not making progress on its own. Also point `relay-connectivity.spec.ts`'s local `settle()` at the shared `waitForAnimations` helper. The card now renders a looping spinner in this state, and a looping animation's `.finished` never resolves, so the old unbounded `Promise.allSettled(getAnimations())` hung until Playwright aborted the evaluate. The shared helper races the wait against a ceiling for exactly this reason. Verified: desktop `pnpm check`, `pnpm test` (3923 pass), and the `relay-connectivity` + `sidebar-relay-card` smoke specs (6 pass). Co-Authored-By: Claude Opus 5 (1M context) Signed-off-by: James Risbey --- desktop/src/app/RelayConnectionOverlay.tsx | 1 + .../src/features/sidebar/ui/AppSidebar.tsx | 1 + .../sidebar/ui/SidebarRelayConnectionCard.tsx | 32 +++++++++++++---- .../ui/useSidebarRelayConnectionCard.ts | 3 ++ desktop/tests/e2e/relay-connectivity.spec.ts | 36 ++++++++++--------- 5 files changed, 50 insertions(+), 23 deletions(-) diff --git a/desktop/src/app/RelayConnectionOverlay.tsx b/desktop/src/app/RelayConnectionOverlay.tsx index 07c6933d04..246e1a1191 100644 --- a/desktop/src/app/RelayConnectionOverlay.tsx +++ b/desktop/src/app/RelayConnectionOverlay.tsx @@ -72,6 +72,7 @@ export function RelayConnectionOverlay({ >