Skip to content

feat(emulator): disconnection alerts, backoff auto-reconnect, loading indicators#67

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/improve-emulator-view
Draft

feat(emulator): disconnection alerts, backoff auto-reconnect, loading indicators#67
Copilot wants to merge 2 commits intomainfrom
copilot/improve-emulator-view

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 30, 2026

The emulator view had no feedback when a streaming connection dropped unexpectedly, no loading visuals during metadata fetch or WebRTC connect, and no recovery mechanism for transient disconnects.

Changes

emulator-error.tsx — new DisconnectionBanner + DisconnectionInfo type

  • DisconnectionInfo: shared type carrying { countdown, attempt, maxAttempts, failed }
  • DisconnectionBanner: accessible role="alert" banner with live countdown, attempt/max display, "Reconnect Now" (skip countdown) and "Dismiss" (cancel reconnect) actions

emulator.css.emu-spinner

  • Lightweight CSS-only spinner (@keyframes emu-spin) usable inline in buttons and placeholders

webrtc-emulator-view.tsx

  • Connect button renders spinner + "Connecting…" while negotiating; canvas placeholder also shows spinner instead of static text
  • handleStateChange distinguishes user-initiated vs unexpected disconnect via userDisconnectRef; unexpected "disconnected" triggers handleUnexpectedDisconnect
  • Exponential backoff reconnect (1 → 2 → 4 → 8 → 16s, capped at 30s, max 5 attempts); all timer state held in refs to avoid stale closures; clearReconnectTimers() helper used consistently
  • DisconnectionBanner displayed with live countdown; unmount effect cancels pending timers

adb-emulator-view.tsx

  • Connect button shows spinner + "Loading metadata…" while isLoadingMeta
  • "No devices" banner is context-aware: initial guidance / post-connect no-devices message / loading state
  • Same backoff reconnect strategy wired to the WebSocket onclose handler; disconnect() sets userDisconnectRef.current = true to suppress reconnect on intentional close
  • DisconnectionBanner rendered above the main emulator area
// Backoff: 1s → 2s → 4s → 8s → 16s, ceiling 30s, 5 attempts max
const delayMs = Math.min(INITIAL_BACKOFF_MS * Math.pow(2, attempt - 1), MAX_BACKOFF_MS);

Copilot AI and others added 2 commits April 30, 2026 11:50
…, loading indicators

Agent-Logs-Url: https://github.com/FirmwareDroid/FMD-WebClient/sessions/c1a63f0a-cd89-48fb-9126-0259ae437ae8

Co-authored-by: 7homasSutter <9306853+7homasSutter@users.noreply.github.com>
… add backoff comment

Agent-Logs-Url: https://github.com/FirmwareDroid/FMD-WebClient/sessions/c1a63f0a-cd89-48fb-9126-0259ae437ae8

Co-authored-by: 7homasSutter <9306853+7homasSutter@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants