Commit 12cfa0d
fix(react-hooks): prevent onComplete from firing prematurely when stream disconnects
The onComplete callback in useRealtimeRun and useRealtimeRunWithStreams was
firing whenever the SSE stream ended, regardless of whether the run had
actually completed. This caused issues in self-hosted environments where
reverse proxies (like Traefik) may close idle connections.
The fix changes the condition from checking `run` to checking `run?.finishedAt`,
ensuring onComplete only fires when the run has actually reached a terminal
state.
Fixes #2856
Co-authored-by: nicktrn <nicktrn@users.noreply.github.com>1 parent a8024af commit 12cfa0d
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
152 | 154 | | |
153 | | - | |
| 155 | + | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| |||
313 | 315 | | |
314 | 316 | | |
315 | 317 | | |
| 318 | + | |
| 319 | + | |
316 | 320 | | |
317 | | - | |
| 321 | + | |
318 | 322 | | |
319 | 323 | | |
320 | 324 | | |
| |||
0 commit comments