Skip to content

Conversation

usu
Copy link
Member

@usu usu commented May 2, 2021

Nuxt serializes Vuex store and Component data objects after the server has finished, which is then hydrated again on the client side.

This is currently not supported by hal-json-vuex. Objects would need to be refetched on client side.

In ecamp, we don't use hydration on client side, but the server still generates lots of warnings, as the serialization cannot be disabled.

This PR avoids these warnings by providing a dummy toJSON implementation on store promises and on StoreValue objects.

Similar problem as described here: vuex-orm/vuex-orm#255

@usu usu requested a review from carlobeltrame May 2, 2021 08:18
Copy link
Member

@carlobeltrame carlobeltrame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation as is looks good to me. How about some unit tests?

Also, wouldn't it be possible to eventually support this kind of serialization "correctly"?
The promises can trivially be reconstructed as reloading promises or resolved promises, depending on their state during serialization (maybe even without queryablePromise, by looking at the loading flag).
The StoreValues could more or less be represented by a URI.

@carlobeltrame
Copy link
Member

Also, maybe document this behaviour (not supporting client-side re-hydration) in the README?

@usu usu requested a review from carlobeltrame May 2, 2021 11:44
@usu usu merged commit 819a6cc into ecamp:next May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants