Apollo-link-rest: Support for Apollo Client 3

Created on 12 Nov 2019  ·  16Comments  ·  Source: apollographql/apollo-link-rest

Apollo-client 3 is in the beta phase now. One of its bigger changes is that apollo-link is now part of @apollo/client.

I tried using the apollo-client beta version, however I am unable to use apollo-link-rest with it as it still references apollo-link, and I end up with two definitions of ApolloLink.

Is there roadmap when apollo-link-rest will be switched to the client? And more importantly is there a workaround to this problem?

Blocked ⛔️ blocking enhancement💡 question❔

Most helpful comment

That's great news! Thanks @rgrove!

So there you have it @cpsnowden -- the Beta is pretty stable then :P

-- I'm happy to tag & ship the official release in the next month or so -- If anybody has any features to squeeze into the milestone we can get it all officially out together!

All 16 comments

@GoranZic I think we need help or a specification on the changes needed to be compatible with Apollo-client 3. Is that something you can help us find?

@benjamn @jbaxleyiii @hwillson — do you have a specification for how to make links forwards/backwards compatible with ApolloClient 3 and 2.x at the same time?

This is the best I could find.
Okay here's the relevant pull request in apollo-client:
https://github.com/apollographql/apollo-client/pull/5412
And here's the relevant pull request from apollo-link project:
https://github.com/apollographql/apollo-link/pull/1158

Reading between the lines, I think we’re going to need breaking changes here :-(

@fbartho the required changes should be fairly minimal. Everything from the apollo-link, apollo-link-http and apollo-link-http-common packages should now be pulled from @apollo/client. We're going to major version bump the packages in https://github.com/apollographql/apollo-link/pull/1158, due to the @apollo/client requirement. So anyone who wants to keep using apollo-client will use the older link versions, whereas anyone who wants to use @apollo/client will use the new versions.

I can submit a PR that introduces the required changes for @apollo/client. Let me know if that's okay, or if you would prefer to look into this yourself.

It’d be lovely if you know what changes are needed!

We haven’t officially shipped this as 1.0 yet, so I guess we’re still in Breaking changes may occur with ever release-land.

Haha - sounds good. I'll get a PR prepped shortly.

@fbartho Since this package is still 0.x.y releases, you are able to perform breaking changes in a minor bump. It would be best to document the breaking change so that users are aware. I believe that NPM using ^0.7.0 would only bump the patch anyways.

@hwillson If I'm not mistaken when reading Migrating to Apollo Client 3.0 the apollo-link-rest packages was left out from the migration process. Is there a reason why it was left out?

Also confusing is that the apollo docs 3.0 state that we should import { RestLink } from '@apollo/link-rest'; but there is no package on npm or in the apollo-link repository

Thanks for reviewing the migration guide @chrisber! https://github.com/apollographql/apollo-link-rest/pull/241 is going to be released when @apollo/client is live, but apollo-link-rest isn't specifically called out in the migration guide as the guide is currently just covering Apollo company managed projects (to help keep the guide shorter). That being said, I think you're right though - due to its popularity, we should mention it in the guide, which I'll do.

As for the @apollo/link-rest mention, that's a mistake! It should still be apollo-link-rest. The @apollo/link-X namespace is only going to be used for Apollo company maintained projects. I'll get that fixed. Thanks again!

Any update on progressing the v0.8.0-beta release to integrate with Apollo Client 3?

@cpsnowden I haven't received enough feedback about bugs or success of the beta build to feel comfortable shipping it as stable!

When I shipped the beta, shortly after that ApolloClient3's release date got pushed back for a few months, so I'm simply not aware if breaking changes occurred after that time.

Have you tried to use it yet? My team is hopefully moving to ApolloClient3 over the next month or so, so I figured if I don't get external feedback on the Beta before then, that we'll have to test into ourselves.

Hey @fbartho! I've been watching this ticket, but didn't realize you were waiting for feedback or I'd have spoken up sooner. 😄

We (SmugMug) have been using apollo-link-rest 0.8.0-beta.0 with Apollo 3 for several months now and haven't run into any issues! It was a painless upgrade as far as apollo-link-rest was concerned, and has been smooth sailing.

That's great news! Thanks @rgrove!

So there you have it @cpsnowden -- the Beta is pretty stable then :P

-- I'm happy to tag & ship the official release in the next month or so -- If anybody has any features to squeeze into the milestone we can get it all officially out together!

Awesome! Thanks @fbartho for the quick response and @rgrove for providing the feedback!

Just to chime in - I've been using v0.8.0-beta.0 since August 2020 always with the latest Apollo, and I've had no issues either 👍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kevinrobayna picture kevinrobayna  ·  6Comments

MichelDiz picture MichelDiz  ·  7Comments

timhwang21 picture timhwang21  ·  7Comments

i-Hun picture i-Hun  ·  4Comments

dphaener picture dphaener  ·  5Comments