diff --git a/lib/app/client.js b/lib/app/client.js index 8a04cc59c8..8f8eee1d3c 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -336,6 +336,12 @@ const NUXT = window.__NUXT__ || {} if (!NUXT) { throw new Error('[nuxt.js] cannot find the global variable __NUXT__, make sure the server is working.') } +<% if (store) { %> +// Replace store state +if (NUXT.state) { + store.replaceState(NUXT.state) +} +<% } %> // Get matched components const path = getLocation(router.options.base) const resolveComponents = flatMapComponents(router.match(path), (Component, _, match, key, index) => { @@ -411,12 +417,6 @@ Promise.all(resolveComponents) nuxtReady(_app) }) } - <% if (store) { %> - // Replace store state - if (NUXT.state) { - store.replaceState(NUXT.state) - } - <% } %> _app.setTransitions = _app.$options._nuxt.setTransitions.bind(_app) if (Components.length) { _app.setTransitions(mapTransitions(Components, router.currentRoute))