Home

Issue: 2663

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

[issue link]

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.

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