diff --git a/lib/app/utils.js b/lib/app/utils.js index e2d444796e..8cebeba6c3 100644 --- a/lib/app/utils.js +++ b/lib/app/utils.js @@ -108,11 +108,12 @@ export function getContext (context, app) { if (ctx.isServer && context.beforeRenderFns) { ctx.beforeNuxtRender = (fn) => context.beforeRenderFns.push(fn) } - <% if (store) { %> - if (ctx.isClient && window.__NUXT__ && window.__NUXT__.state) { - ctx.serverStoreState = window.__NUXT__.state + if (ctx.isClient && window.__NUXT__) { + ctx.serverState = window.__NUXT__ + <% if (store) { %> + ctx.serverStoreState = ctx.serverState.state + <% } %> } - <% } %> return ctx }