apollo-link icon indicating copy to clipboard operation
apollo-link copied to clipboard

handle external fetch abort

Open rezof opened this issue 6 years ago • 10 comments

  • 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 avatar Nov 29 '18 13:11 rezof

@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/

apollo-cla avatar Nov 29 '18 13:11 apollo-cla

Codecov Report

Merging #880 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@           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-io avatar Feb 11 '19 11:02 codecov-io

Codecov Report

Merging #880 into master will decrease coverage by 0.05%. The diff coverage is 90%.

Impacted file tree graph

@@            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-io avatar Feb 11 '19 11:02 codecov-io

Codecov Report

Merging #880 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@           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-io avatar Feb 11 '19 11:02 codecov-io

I've run into this issue. When will this change be implemented as it is holding my project back?

jmadelaine avatar Feb 17 '19 20:02 jmadelaine

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.

JoviDeCroock avatar Feb 17 '19 22:02 JoviDeCroock

@hwillson @JoviDeCroock test added

rezof avatar Feb 20 '19 18:02 rezof

Any news on this?

Optarion avatar Mar 25 '19 16:03 Optarion

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?

helfer avatar Apr 28 '19 19:04 helfer

It would be nice of useLazyQuery() returned a "cancel" function.

mo avatar Jul 02 '20 08:07 mo