Skip to content

refactor: decouple useCollaborationStatus from lint WebSocket endpoint #140

Description

@JohnRDOrazio

Problem

useCollaborationStatus (lib/hooks/useCollaborationStatus.ts) is a collaboration presence hook that currently connects to the lint WebSocket endpoint (/api/v1/projects/{id}/lint/ws) as a placeholder. This creates confusion:

  • The hook name suggests collaboration/presence but connects to lint
  • The ConnectionStatus icon in the editor toolbar shows lint WS status labeled as collaboration
  • HealthCheckPanel independently creates its own lint WebSocket connection — so there are two connections to the same endpoint with different purposes
  • The hardcoded "disabled" collab icon (state="disabled", endpoint="/api/v1/collab/ws") sits next to the lint-backed "collab" icon

Proposed changes

  1. useCollaborationStatus should connect to a future /api/v1/collab/ws endpoint for real-time presence (or be disabled until that endpoint exists)
  2. Lint WebSocket status should be managed solely by HealthCheckPanel and only when the panel is open
  3. The editor toolbar should show:
    • A collaboration presence icon (connected to /collab/ws when available, disabled until then)
    • A lint/index status icon (connected only when the health check panel is open)
  4. Remove the duplicate "disabled" hardcoded ConnectionStatus icon from the editor toolbar

Current architecture

Editor toolbar:
  [collab icon: disabled]  [lint icon: useCollaborationStatus → /lint/ws]

HealthCheckPanel (when open):
  creates its own WebSocket → /lint/ws (with token auth)

Target architecture

Editor toolbar:
  [collab icon: useCollaborationStatus → /collab/ws (or disabled)]
  [lint icon: reflects HealthCheckPanel WS status when open]

HealthCheckPanel (when open):
  creates WebSocket → /lint/ws (with token auth)
  exposes connection status to parent

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions