Commit 56a50f5
authored
fix: disconnect EventSource when navigating away from session detail (#512)
## Problem
When navigating from a session detail page to the sessions list page,
the frontend would hang with all network requests stuck in "pending"
state. This only occurred in OpenShift deployments, not locally.
The root cause: the EventSource (SSE) connection wasn't being cleaned up
when unmounting the session detail component. This left the connection
open and blocked the browser's connection pool (6 concurrent connections
per domain).
## Solution
Added a cleanup function in the useEffect hook that calls
`aguiStream.disconnect()` when the component unmounts. This properly
closes the EventSource connection.
## Changes
-
**components/frontend/src/app/projects/[name]/sessions/[sessionName]/page.tsx**:
Added return cleanup function in the AG-UI connection useEffect
## Testing
1. Navigate to a session detail page (connection opens)
2. Navigate back to sessions list (connection now properly closes)
3. All network requests work normally - no more hanging
## Impact
- ✅ Fixes frontend hanging on navigation
- ✅ Prevents resource leaks from unclosed connections
- ✅ No breaking changes - purely additive cleanup
- ✅ MVP fix - minimal changes for maximum impact1 parent 903f020 commit 56a50f5
File tree
1 file changed
+8
-1
lines changed- components/frontend/src/app/projects/[name]/sessions/[sessionName]
1 file changed
+8
-1
lines changedLines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
234 | 241 | | |
235 | 242 | | |
236 | 243 | | |
| |||
0 commit comments