Static GitHub Issues

[2663] Loss of prototype information by initial state passing from server to client

prev: nuxt express post conflict?
next: resolve static page routes before dynamic ones to prevent conflict

In Vuex it is possible to store class instance in state, but Nuxt has a problem with this.

When a state initiated on the server side is handed over to the client, the class instances get turned into a plain objects. I guess this is due to deserialization of all serialized state by server side rendering.

If you do not use Nuxt, you write new Store (...) and store.replaceState(), so there is a chance to modify plane object to class instance, but we can not when using Nuxt.

Are there any good ideas on this? I thought that we needed a workaround like nuxtServerInit (), which can modify state just after (or before) replaceState () is executed.

Regards.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2317">#c2317</a>)</em></sub></div>