Files
vibe-kanban/frontend
Anastasiia Solop 1fd114b75d I've fixed the bug in frontend/src/hooks/useLogStream.ts. Here's a summary of the issue and the fix: (#2027)
## Problem

When multiple dev servers are running and the user switches between log tabs, logs from one dev server could appear in another dev server's tab. This happened because:

1. When `processId` changes (user switches tabs), the effect cleanup closes the old WebSocket
2. But WebSocket `close()` is asynchronous - the old WebSocket's event handlers can still fire
3. The old WebSocket's `onmessage` handler was still calling `setLogs()`, which would update the logs state even after switching to a different process

## Solution

Added a `currentProcessIdRef` ref to track the current active `processId`, and a `capturedProcessId` variable that captures the processId when each WebSocket is opened. All event handlers now check if their captured processId matches the current one before updating state:

1. **`onopen`**: Closes the WebSocket immediately if processId has changed since opening
2. **`addLogEntry`**: Discards log entries if they're from a stale WebSocket
3. **`onerror`**: Ignores errors from stale WebSocket connections
4. **`onclose`**: Prevents retry logic from running for stale connections

This ensures that each WebSocket connection only affects state when it's still the active connection for the currently selected process.
2026-01-14 08:05:55 +01:00
..
2026-01-13 18:00:57 +00:00
2026-01-08 22:14:38 +00:00
2025-06-25 09:36:07 +01:00
2026-01-08 22:14:38 +00:00
2026-01-08 22:14:38 +00:00
2026-01-08 22:14:38 +00:00
2026-01-13 18:32:23 +00:00
2026-01-08 22:14:38 +00:00
2025-06-14 15:14:08 -04:00
2026-01-08 22:14:38 +00:00