Skip to content

Commit

Permalink
fix: break reference to state object
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Schwab committed Jun 9, 2020
1 parent 732f19d commit 6641b68
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/templates/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ export default (ctx, inject) => {
if (process.server) {
const ApolloSSR = require('vue-apollo/ssr')
beforeNuxtRender(({ nuxtState }) => {
nuxtState.apollo = ApolloSSR.getStates(apolloProvider)
nuxtState.apollo = {}
const states = ApolloSSR.getStates(apolloProvider)

for (let clientName in states) {
nuxtState.apollo[clientName] = Object.assign({}, states[clientName])
}

// Clear apollo client cache after each request
// Issues: https://github.com/nuxt-community/apollo-module/issues/273
// https://github.com/nuxt-community/apollo-module/issues/251
Expand Down

0 comments on commit 6641b68

Please sign in to comment.