urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
https://urql.dev/goto/docs
MIT License
8.57k stars 444 forks source link

fix(core): allow controll by signal from fetchOptions #3378

Closed rexpan closed 10 months ago

rexpan commented 11 months ago

Resolves #3377

Summary

The signal passed from fetchOptions by user be ignored and overrided.

Set of changes

Listen to abort event from user passed signal and abort the current request.

tatianajiselle commented 10 months ago

I can confirm that I am experiencing the bug myself, would appreciate this being resolved.

kitten commented 10 months ago

@tatianajiselle I left a comment on #3377 trying to answer all three streams of this discussion, but basically, I don't consider this a bug or missing feature right now, and instead, would recommend to write a fetch wrapper and pass that to the Client. There's a further explanation in the issue's comment, but I wouldn't consider using the AbortSignal that's passed in as more useful or more correct, given that it isn't more practical than either a custom exchange or a fetch wrapper, and also isn't a practical public API

Edit: Also, to clarify, I wasn't sure whether the original issue in #3377 and the Discord thread were from the same team, so I assumed as much given the timing 😅 But apologies if they're not

tatianajiselle commented 10 months ago

all good! moving convo to #3377 for simplicity

kitten commented 10 months ago

As per the conversation in #3377, since signal is not part of the public API (1) because HTTP is not assumed and hence fetchOptions is limited, and (2) since it's not expected to set up a timeout or otherwise pass an AbortSignal in the UI layer to the Client, what this change adds is not expected to work.