Skip to content

[BUG] useSSE hook has no onerror handler — SSE connection failures are invisible to users #44

@nightmare0329

Description

@nightmare0329

Description

src/hooks/useSSE.ts registers three addEventListener listeners on the EventSource but never sets an onerror handler. When the SSE connection drops or the server is unreachable, the browser silently retries in the background — users continue seeing the dashboard with no indication that live data may be stale.

Current code

const es = new EventSource(SSE_URL);
es.addEventListener("event", () => { ... });
es.addEventListener("miner", () => { ... });
es.addEventListener("swap",  () => { ... });
// No es.onerror handler

Expected Behavior

An onerror handler should be registered so the application can:

  • Log the connection failure for debugging
  • Optionally surface a UI indicator (e.g. a stale-data banner or connection-lost toast) when the SSE feed is broken

Actual Behavior

SSE errors are swallowed. A user whose connection drops sees the dashboard frozen on the last snapshot with no feedback, and has no way to know the live feed is disconnected.

File

src/hooks/useSSE.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions