Skip to content

Commit

Permalink
fix(nuxt-bridge): add support for nuxt bridge
Browse files Browse the repository at this point in the history
Nuxt Bridge exposes the Nuxt 2 context via nuxtApp.nuxt2Context.

However, when doing `app.apolloProvider`, the apolloProvider is not added to this context.

In order to get the apolloProvider onto this nuxt2Context, we must use inject().

However, it requires a different name than "apolloProvider" when injecting, or we get errors.
  • Loading branch information
Jamiewarb committed Dec 20, 2021
1 parent 83e4642 commit e10cdcf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/templates/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export default (ctx, inject) => {
const apolloProvider = new VueApollo(vueApolloOptions)
// Allow access to the provider in the context
app.apolloProvider = apolloProvider
inject('theApolloProvider', apolloProvider);

if (process.server) {
const ApolloSSR = require('vue-apollo/ssr')
Expand Down

0 comments on commit e10cdcf

Please sign in to comment.