next.js
4f72e867 - Next.js: dispose native subscriptions when iterators are canceled or the dev server closes

Commit
8 days ago
Next.js: dispose native subscriptions when iterators are canceled or the dev server closes The subscribe() helper overrode iterator.return() to only reject the consumer's pending wait; unless the generator happened to be suspended at that exact yield, it was never resumed, so its finally — the only rootTaskDispose call — never ran and the native root task (and its buffered emissions) leaked for the process lifetime. - return() now also drives the generator through its finally, and post-cancel native emissions are dropped instead of buffered. - RootTask::drop now stops the root task as a GC backstop (was a TODO). - unsubscribeFromClientHmrEvents deletes the dead map entry, and hot-reloader close() tears down the entrypoints, update-info, server-HMR, and endpoint-change subscriptions (setupServerHmr returns a stopper that also stops the resubscribe loop).
Author
Committer
Parents
Loading