Skip to content

WebSocket connection errors silently swallowed; connected state is hardcoded to true #3

Description

@coderanik

Description

The Yjs WebSocket provider in the Editor component has no error handling for connection failures. If the WebSocket server is down or the connection drops, users get no feedback and can lose edits. Additionally, the connected state in the parent page is hardcoded to true and never updated.

Locations

  • frontend/src/app/projects/[projectId]/page.tsx:53const [connected] = useState(true) (always true, no setter)
  • frontend/src/components/Editor.tsx:105-111 — only listens for "sync" event, ignores "status" and connection errors

Expected Behavior

  1. The Editor should expose connection status changes (via callback or ref)
  2. Listen for provider.on("status", ...) events from y-websocket
  3. Pass real connection state up to the parent
  4. Replace hardcoded useState(true) with actual connection tracking
  5. Show disconnected status in StatusBar
  6. Add automatic reconnection with visual indicator

Difficulty: Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions