apollo-link
apollo-link copied to clipboard
handle external fetch abort
- fixes issue
- test already covered, but i can write a specific test for it if needed
TODO:
- [X] Make sure all of new logic is covered by tests and passes linting
- [ ] Update CHANGELOG.md with your change
@rezof: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/
Codecov Report
Merging #880 into master will not change coverage. The diff coverage is
100%
.
@@ Coverage Diff @@
## master #880 +/- ##
=======================================
Coverage 95.21% 95.21%
=======================================
Files 22 22
Lines 1024 1024
Branches 109 109
=======================================
Hits 975 975
Misses 44 44
Partials 5 5
Impacted Files | Coverage Δ | |
---|---|---|
packages/apollo-link-http/src/httpLink.ts | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 243c080...215cbad. Read the comment docs.
Codecov Report
Merging #880 into master will decrease coverage by
0.05%
. The diff coverage is90%
.
@@ Coverage Diff @@
## master #880 +/- ##
==========================================
- Coverage 95.19% 95.14% -0.06%
==========================================
Files 22 22
Lines 1020 1029 +9
Branches 103 103
==========================================
+ Hits 971 979 +8
- Misses 44 45 +1
Partials 5 5
Impacted Files | Coverage Δ | |
---|---|---|
packages/apollo-link-http/src/httpLink.ts | 100% <100%> (ø) |
:arrow_up: |
.../apollo-link-http/src/__tests__/sharedHttpTests.ts | 93.82% <88.88%> (-0.11%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 8e0ef32...eeb1d52. Read the comment docs.
Codecov Report
Merging #880 into master will not change coverage. The diff coverage is
100%
.
@@ Coverage Diff @@
## master #880 +/- ##
=======================================
Coverage 95.21% 95.21%
=======================================
Files 22 22
Lines 1024 1024
Branches 109 109
=======================================
Hits 975 975
Misses 44 44
Partials 5 5
Impacted Files | Coverage Δ | |
---|---|---|
packages/apollo-link-http/src/httpLink.ts | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 243c080...215cbad. Read the comment docs.
I've run into this issue. When will this change be implemented as it is holding my project back?
I've run into this issue. When will this change be implemented as it is holding my project back?
When this test is implemented it will probably be pushed forward. If OP doesn't feel up to this, I'll try.
@hwillson @JoviDeCroock test added
Any news on this?
FWIW, I think this PR makes sense, but it isn't a solution to the original issue. Using an AbortController to reach into the link stack and abort a request instead of unsubscribing breaks the abstraction. If you continue trying to work around it by putting in ifs and elses here and there, the code will become bloated and much more complicated, and you'll likely introduce more bugs and corner-cases along the way.
I think the most logical way to go about this would be to make the promise returned by client.query
cancelable (if it isn't already), and then propagating that cancellation up the stack. Presumably this is already what happens with watchQuery
anyway when you unsubscribe?
It would be nice of useLazyQuery() returned a "cancel" function.