Skip to content

Commit

Permalink
Clean up listener after it's used once
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Mar 18, 2021
1 parent ab84723 commit 28c0533
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/react-dom/src/server/ReactDOMFizzServerBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ function renderToReadableStream(
): ReadableStream {
let request;
if (options && options.signal) {
options.signal.addEventListener('abort', () => abort(request));
const signal = options.signal;
const listener = () => {
abort(request);
signal.removeEventListener('abort', listener);
};
signal.addEventListener('abort', listener);
}
return new ReadableStream({
start(controller) {
Expand Down

0 comments on commit 28c0533

Please sign in to comment.