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
fixed abort pending request of internetReachability #700
Conversation
AbortController.abort() throws DOMException with name AbortError. This exception rejects promise with reason declared in abort function attribute.
fixed abort pending request of internetReachability
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.
Interesting, I have not personally played around with AbortController but this appears sane+correct based on my read of the relevant docs you helpfully linked. Thanks!
Some problematic test results:
|
Sorry. I hurried. I edited the file in Github. Didn't take into account return types. |
CI behaving strangely - only closing so I can reopen which typically kicks off a CI round |
Ok - will merge and release this, it seems reasonable, please please 🙏 keep an ear out in case there are issues here, hopefully this just works for others using this functionality |
## [11.1.1](v11.1.0...v11.1.1) (2023-11-29) ### Bug Fixes * internetReachability aborts handle cancel correctly ([#700](#700)) ([0a36296](0a36296))
🎉 This PR is included in version 11.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@gizomo did this PR fix some real issue for you? I am asking because it introduced one on our side because of a broken check by error message here. Since the explicit reject has been removed - abort message is cc @matt-oakes. |
@Tymofiev - Matt Oakes no longer works on the repo so cc'ing him has no effect, it's just his user account key that still does releases Anyway, I'm listening as I was afraid this may affect others. Is there some reason you cannot inspect on the abort reason in order to differentiate, as mentioned in the issue related to the PR?
|
@mikehardy I am sorry, I meant to tag you here. It is possible to inspect on the abort reason from the signal [1], but I was wondering if we could just revert the promise reject, so no extra work required to check signal reason. Or we could use
PS: Examples taken from https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal. |
Reasonab PRs accepted but please coordinate philosophically with @gizomo |
@mikehardy yeah, okay, that's why I asked him the reason behind this change. |
Using an AbortController actually cancels the fetch. Rejecting a promise is not able to cancel the fetch, that can lead to a memory leak. I don't advocate using the 'canceled' string as a reason. We can use DOMException checking Actually, we should revert |
@gizomo thanks for the quick reply. I think it would still cancel the promise if you call abort without any reason, and reject is just to make sure we can track the exact error message. Let's revert the reject to return the previous behaviour and as you said make sure it works in case AbortController API is not supported. Does it sound good? PS: I am all into opening new PR to do that. |
AbortController.abort() throws DOMException with name AbortError. This exception rejects promise with reason declared in abort function attribute as I described at #699