Skip to content

feat(frontend): WebSocket real-time indexing progress (#115)#151

Merged
DevanshuNEU merged 2 commits into
OpenCodeIntel:mainfrom
DevanshuNEU:feature/115-websocket-indexing-ui
Jan 6, 2026
Merged

feat(frontend): WebSocket real-time indexing progress (#115)#151
DevanshuNEU merged 2 commits into
OpenCodeIntel:mainfrom
DevanshuNEU:feature/115-websocket-indexing-ui

Conversation

@DevanshuNEU

@DevanshuNEU DevanshuNEU commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

Frontend WebSocket Implementation for Real-Time Indexing Progress

Closes #115

What This PR Does

Implements the frontend WebSocket integration for real-time indexing progress, building on the backend WebSocket endpoint from PR #150.

Key Features

1. useIndexingWebSocket Hook

const wsState = useIndexingWebSocket(jobId, {
  maxRecentFiles: 12,
  onCompleted: (repoId, stats) => { ... },
  onError: (error, recoverable) => { ... },
});
  • Type-safe WebSocket state machine
  • Auto-reconnect with exponential backoff (max 3 attempts)
  • Fallback to HTTP polling if WebSocket fails
  • Streaming file list buffer

2. Enhanced IndexingProgress Component

  • Streaming file list - Files appear in real-time as processed 🎬
  • Phase indicators: Clone → Index → Done
  • Glowing progress bar with animation
  • Language-aware file icons ( Python, React, etc.)
  • Staggered entry animations using Framer Motion

3. IndexingComplete Celebration Screen

  • Confetti animation on success
  • Animated stat counters (count up effect)
  • Success glow gradient
  • CTA buttons: "Start Searching" / "Index Another"

4. Updated HeroPlayground

  • Integrated WebSocket for custom repo indexing
  • AnimatePresence for smooth state transitions
  • Shows celebration screen on completion
  • Error handling with retry option

Files Changed

File Change
hooks/useIndexingWebSocket.ts NEW - WebSocket state machine
components/playground/IndexingComplete.tsx NEW - Celebration UI
components/playground/IndexingProgress.tsx Enhanced with streaming
components/playground/HeroPlayground.tsx WS integration
components/playground/index.ts Updated exports

The "Holy Shit" Moment

The streaming file list was identified in our team meeting as the key differentiator vs polling:

Polling: Updates chunk every 2s (feels slow)
WebSocket: Files stream in real-time (feels ALIVE)

📄 src/auth/login.py       ← processing
📄 src/auth/oauth.py
📄 src/models/user.py
📄 src/routes/api.py
+8 more files processed

Testing

  • Build passes (npm run build)
  • TypeScript types check
  • Manual testing with live backend (pending backend PR merge)

Event Flow

Backend Job → Redis Pub/Sub → WS Endpoint → Browser
                              ↓
           connected → cloning → progress (streaming) → completed

Dependencies

Requires backend PR #150 to be merged first for full E2E functionality.

)

🚀 Features:
- useIndexingWebSocket hook with auto-reconnect & polling fallback
- Streaming file list - shows files appearing in real-time
- Enhanced IndexingProgress with phase indicators & glow effects
- IndexingComplete celebration screen with confetti & animated stats
- Integrated WebSocket into HeroPlayground component

📁 Files:
- NEW: hooks/useIndexingWebSocket.ts (WebSocket state machine)
- NEW: components/playground/IndexingComplete.tsx (celebration UI)
- UPDATED: components/playground/IndexingProgress.tsx (streaming file list)
- UPDATED: components/playground/HeroPlayground.tsx (WS integration)
- UPDATED: components/playground/index.ts (exports)

🎨 UX Highlights:
- Files stream in real-time as they're processed
- Phase indicator: Clone → Index → Done
- Glowing progress bar
- Confetti on completion
- Animated stat counters

Connects to backend WebSocket endpoint from PR OpenCodeIntel#150
@vercel

vercel Bot commented Jan 5, 2026

Copy link
Copy Markdown

@DevanshuNEU is attempting to deploy a commit to the Dev's projects Team on Vercel.

A member of the Team first needs to authorize it.

Root cause: Callbacks and options object recreated on every render
caused useEffect dependencies to constantly change.

Fixes:
- Use refs for onCompleted/onError callbacks (stable across renders)
- Memoize wsOptions with useMemo in HeroPlayground
- Destructure wsState immediately to get stable references
- Fixed dependency arrays to use primitive values not objects

HeroPlayground changes:
- useCallback for handleWsCompleted, handleWsError
- useMemo for wsOptions object
- Destructure hook result instead of using wsState object in deps

useIndexingWebSocket changes:
- Store callbacks in refs (onCompletedRef, onErrorRef)
- Update refs synchronously (no useEffect needed)
- Cleaner, more compact implementation
@vercel

vercel Bot commented Jan 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
opencodeintel Ready Ready Preview, Comment Jan 6, 2026 1:52am

@DevanshuNEU DevanshuNEU merged commit 6bf8439 into OpenCodeIntel:main Jan 6, 2026
6 checks passed
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.

feat(frontend): Real-time indexing progress component

1 participant