Implement client-side SSE handling #35

Closed
opened 2025-12-29 23:48:24 +00:00 by cardosofelipe · 0 comments

Description

Create React hooks and utilities for consuming SSE events.

Requirements

Hook: useProjectEvents

function useProjectEvents(projectId: string): {
  events: ProjectEvent[];
  isConnected: boolean;
  error: Error | null;
  reconnect: () => void;
}

Features

  • Automatic reconnection with exponential backoff
  • Event parsing and type safety
  • Connection state management
  • Event buffer (last 100 events)

Event Store

interface EventStore {
  events: ProjectEvent[];
  addEvent: (event: ProjectEvent) => void;
  clearEvents: () => void;
}

Components

  • ConnectionStatus indicator
  • EventList component (for activity feed)

Tests

  • Hook behavior
  • Reconnection logic
  • Event parsing
  • Store management

Acceptance Criteria

  • useProjectEvents hook implemented
  • Auto-reconnection working
  • Type-safe event handling
  • Connection status UI
  • Unit tests

Dependencies

  • Depends on: #34 (SSE endpoint)

Assignable To

frontend-engineer agent

## Description Create React hooks and utilities for consuming SSE events. ## Requirements ### Hook: useProjectEvents ```typescript function useProjectEvents(projectId: string): { events: ProjectEvent[]; isConnected: boolean; error: Error | null; reconnect: () => void; } ``` ### Features - Automatic reconnection with exponential backoff - Event parsing and type safety - Connection state management - Event buffer (last 100 events) ### Event Store ```typescript interface EventStore { events: ProjectEvent[]; addEvent: (event: ProjectEvent) => void; clearEvents: () => void; } ``` ### Components - ConnectionStatus indicator - EventList component (for activity feed) ### Tests - Hook behavior - Reconnection logic - Event parsing - Store management ## Acceptance Criteria - [ ] useProjectEvents hook implemented - [ ] Auto-reconnection working - [ ] Type-safe event handling - [ ] Connection status UI - [ ] Unit tests ## Dependencies - Depends on: #34 (SSE endpoint) ## Assignable To frontend-engineer agent
cardosofelipe added the frontendphase-1 labels 2025-12-29 23:50:16 +00:00
Sign in to join this conversation.