Closed jgonera closed 4 years ago
I'm happy to submit a PR if that sounds good, but I would like to know whether I'm missing something before I do that.
Hi @jgonera. Thanks for the info. I think you have interesting points and I need to think about it.
@jgonera can you submit a PR, please?
@ihorkatkov May I ask why this is closed? It doesn't seem like this is fixed.
@tcitworld Hey! No, it wasn't handled. I would be happy if you could drop rxjs altogether. Thanks
Hi @ihorkatkov 👋
Is there still any interest in ditching rxjs
? fetch
is now well-supported by all modern browsers so I'm thinking that we can remove rxjs and release a new major version. People who need polyfill can provide their own.
I can create a pull request if it makes sense.
The readme says:
Which made me think that if I don't use custom
fetch
, then browser's nativefetch
would be used. That is not the case and insteadajax
fromrxjs
is being used if custom fetch is not provided. This has two major problems:Observable
returned when rxjs is used does not have the same interface as a regularObservable
(I am not sure how this is happening, but see the implications below).apollo-absinthe-upload-link
's size is over 50KB gzipped, over 48KB being rxjs.When it comes to number 1, composing with other links can be problematic. Let's say we have another link like this:
(https://www.apollographql.com/docs/link/overview.html)
Then if we try to use it together with
apollo-absinthe-upload-link
like this:we will get the following error:
Since the app I'm working on is compatible only with modern browsers, I work around this by initializing the link like this:
This skips the whole rxjs code path, which brings me to point number 2. I am including 48KB of dead code:
My proposal is to by default use browser's native
fetch
and remove rxjs as a dependency. It can be mentioned in the readme that if someone needs compatibility with older browsers, they can provide a customfetch
function.