Home

Issue: 650

Window is not defined when store is activated

[issue link]

Since window is not defined when store is activated, I don’t see a way to refill the store from localStorage before any of the page components get loaded.
Tried:

  • Creating store from a plugin and middleware
  • Directly writing to window.__NUXT__.state from a plugin
  • Waiting for window to load inside store/index.js

So, I ended up refilling the store from localStorage on mounted of one of the ~components/
Are there any ways of doing it?

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