nuxt-modules / apollo

Nuxt.js module to use Vue-Apollo. The Apollo integration for GraphQL.
https://apollo.nuxtjs.org
MIT License
945 stars 199 forks source link

Get rid of vue-cli-plugin-apollo as it uses Apollo Client 2 #404

Open fabis94 opened 3 years ago

fabis94 commented 3 years ago

vue-cli-plugin-apollo relies on Apollo Client 2 which is an outdated version. Also it doesn't look like they're going to add Apollo Client 3 support anytime soon - https://github.com/Akryum/vue-cli-plugin-apollo/issues/441

So maybe this dependency can be removed and Apollo Client can be initialized manually?

P.S. I tried using https://cmty.app/nuxt/issues/new?repo=apollo-module to submit this issue, but the link doesn't work due to a DNS resolution error

negezor commented 3 years ago

There will be problems with the migration to Apollo 3 if the Composable API is used (I do not know how with Dollar Apollo). Slow loading occurs in SSR with requests in different components.

If you are not interested in SSR, then this completely works, here is a simple example code in the form of a plugin (the part with SSR can be cut, it also uses beforeSerialize, which will only be in Nuxt 1.16 for the state used by hydration) https://github.com/negezor/nuxt-apollo-3-slow-ssr/blob/master/plugins/apollo.js

fabis94 commented 3 years ago

SSR is a requirement for me, so it won't work for me, but thanks for the input. Can you elaborate on this?:

Slow loading occurs in SSR with requests in different components.

Why does this happen? And why does it only happen when the Composable API is used?

negezor commented 3 years ago

Why does this happen? And why does it only happen when the Composable API is used?

I tried to figure it out on my own, but it didn't work out for me. That's why I created this issue.

negezor commented 3 years ago

@fabis94 fix for slow loading is quite easy. You just need to apply the fix from this https://github.com/vuejs/vue-apollo/pull/1241, I also described how to do it here.

productdevbook commented 2 years ago

@negezor https://github.com/vuejs/vue-apollo/pull/1241 fixed

negezor commented 2 years ago

@productfrontenddeveloper Yes, I'm already using 😅