Skip to content

Commit

Permalink
fix(fetch): weaker refs (#1824)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag authored Dec 22, 2022
1 parent 1b858fb commit f035bbc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/fetch/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,10 @@ class Request {
if (signal.aborted) {
ac.abort(signal.reason)
} else {
const abort = () => ac.abort(signal.reason)
const acRef = new WeakRef(ac)
const abort = function () {
acRef.deref()?.abort(this.reason)
}
signal.addEventListener('abort', abort, { once: true })
requestFinalizer.register(this, { signal, abort })
}
Expand Down

0 comments on commit f035bbc

Please sign in to comment.