mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix: Move back store hydration before plugins execution
This commit is contained in:
parent
251d87914d
commit
79a64df422
@ -135,13 +135,6 @@ async function createApp (ssrContext) {
|
||||
<% } %>
|
||||
}
|
||||
|
||||
<% plugins.filter(p => p.ssr).forEach(plugin => { %>
|
||||
if (typeof <%= plugin.name %> === 'function') await <%= plugin.name %>(ctx, inject)<% }) %>
|
||||
<% if (plugins.filter(p => !p.ssr).length) { %>
|
||||
if (process.browser) { <% plugins.filter(p => !p.ssr).forEach(plugin => { %>
|
||||
if (typeof <%= plugin.name %> === 'function') await <%= plugin.name %>(ctx, inject)<% }) %>
|
||||
}<% } %>
|
||||
|
||||
<% if (store) { %>
|
||||
if (process.browser) {
|
||||
// Replace store state after calling plugins
|
||||
@ -151,6 +144,13 @@ async function createApp (ssrContext) {
|
||||
}
|
||||
<% } %>
|
||||
|
||||
<% plugins.filter(p => p.ssr).forEach(plugin => { %>
|
||||
if (typeof <%= plugin.name %> === 'function') await <%= plugin.name %>(ctx, inject)<% }) %>
|
||||
<% if (plugins.filter(p => !p.ssr).length) { %>
|
||||
if (process.browser) { <% plugins.filter(p => !p.ssr).forEach(plugin => { %>
|
||||
if (typeof <%= plugin.name %> === 'function') await <%= plugin.name %>(ctx, inject)<% }) %>
|
||||
}<% } %>
|
||||
|
||||
if (process.server && ssrContext && ssrContext.url) {
|
||||
await new Promise((resolve, reject) => {
|
||||
router.push(ssrContext.url, resolve, reject)
|
||||
|
@ -110,9 +110,6 @@ export function getContext (context, app) {
|
||||
}
|
||||
if (ctx.isClient && window.__NUXT__) {
|
||||
ctx.serverState = window.__NUXT__
|
||||
<% if (store) { %>
|
||||
ctx.serverStoreState = ctx.serverState.state
|
||||
<% } %>
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user