Home

Issue: 1440

store.replaceState(initalState) did not replace store state

[issue link]

I am trying to “feed” my vuex store with an initial data that has been stored on localStorage. I have try to use vuex-persiststate and write my own plugin which is just get the localStorage state, and calling store.replaceState.
But, it did not replace vuex store, after digging into .nuxt directory I found that the store will be feed with window.__NUXT__.state

The question are, why my store.replaceState did not replace the state? Or, is there any better way to set initial state? Without store.commit("init", initialState) if possible.

This question is available on Nuxt.js community (#c1285)