Clean up dev errors RSC streams the HMR client never consumes
Every HTML render in dev stores its errors RSC stream keyed by
htmlRequestId so the stream can be sent once the HMR client connects. The
entry was only deleted when a client actually consumed it, so any render
whose client never connected (curl, disabled JavaScript, bots, or simply
closing the tab before the websocket upgrade) left the stream - and the
RSC payload buffered in it - alive for the lifetime of the dev server.
The module already carried a TODO for exactly this cleanup.
Adds a 60s cleanup timer per stored entry (unref'ed backstop), cancelled
when the entry is consumed or deleted.
Unit tests cover consumption before the timeout, abandonment cleanup,
explicit deletion, and timer replacement. Without the fix the
abandonment test fails: the stream is retained forever.
Co-Authored-By:
Marcos Hernanz <96699542+marcoshernanz@users.noreply.github.com>
Showing
Please
register
or
sign in
to comment