From 474f68e46e7161e4cb24f256f7752e873e977d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 24 Mar 2017 01:28:38 +0100 Subject: [PATCH] Call store.replaceState on start --- lib/app/client.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/app/client.js b/lib/app/client.js index 8a04cc59c..8f8eee1d3 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))