Commit d1b2ed0
fix: don't crash the server when a streaming response is aborted
The generated SSR handler piped render output straight into the
ReadableStream controller. Enqueueing after the client aborts (page
reload, navigation away) throws ERR_INVALID_STATE — and streamed
fragments write seconds after the shell, so a mid-stream abort took
down the whole Node process from writeTasks. Guard writes behind a
closed flag, absorb the close race in end(), and mark closure on
cancel().
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 7a98823 commit d1b2ed0
2 files changed
Lines changed: 13 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
481 | 484 | | |
482 | 485 | | |
483 | | - | |
| 486 | + | |
| 487 | + | |
484 | 488 | | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
| 489 | + | |
| 490 | + | |
491 | 491 | | |
492 | 492 | | |
| 493 | + | |
493 | 494 | | |
494 | 495 | | |
495 | 496 | | |
| |||
0 commit comments