-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use native AbortController #11753
use native AbortController #11753
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for diving in and solving this mystery 🎉
// that includes the `signal` option, which (with the native `AbortController`) | ||
// has a reference to the `Request` instance, which will somehow reference our | ||
// hash object | ||
fetchMock.resetHistory(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how much overhead this would add, but: thoughts on calling this in an afterEach
to make these tests future-proof?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so - in this case, it was even within the test.
In the long run, we should probably move away from mock-fetch
, so I wouldn't spend too much time with it now, tbh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right! Forgot that it wasn't just at the top of the test :/ makes sense 👍
… in the environemt (#11751) * fix: use custom jsdom env insted of patching it via patch package * Clean up Prettier, Size-limit, and Api-Extractor * use native `AbortController` (#11753) --------- Co-authored-by: Lenz Weber-Tronic <[email protected]> Co-authored-by: phryneas <[email protected]>
This is a follow-up to #11751
Using the native
AbortController
previously created a memory leak in our tests, becausemock-fetch
keeps a history of requests - which referenced thesignal
- and thesignal
keeps a reference to theAbortController
, so theAbortController
itself was never cleared up, and theRequest
somehow stayed in memory, including a reference to ourref
.