Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server / Client APIs don't match #8

Open
0xradical opened this issue Nov 29, 2019 · 2 comments
Open

Server / Client APIs don't match #8

0xradical opened this issue Nov 29, 2019 · 2 comments

Comments

@0xradical
Copy link

0xradical commented Nov 29, 2019

Hi Felipe! Nice lib!

I'm trying to understand why in clientside's renderVuex (defined on https://github.com/ara-framework/hypernova-vue/blob/master/src/index.ts#L100), you expect propsData to be encapsulated by a data key, but then on the serverside's renderVuex (https://github.com/ara-framework/hypernova-vue/blob/master/src/server.ts#L39) there's no such expectation.

Am I missing something ?

Thank you!

@0xradical
Copy link
Author

On https://github.com/airbnb/hypernova-react/blob/master/src/index.js, parameters data and props (client & server, respectively) are basically the same thing.

@marconi1992
Copy link
Member

The renderVue works in the same way as renderReact. However, for renderVuex we need to save somewhere the Vuex store's state when the server-side rendered view is serialized in order to hydrate it on the client-side.

https://github.com/ara-framework/hypernova-vue/blob/master/src/server.ts#L55

This why we need to get the component's props from the propsData key and use state to hydrate the data for the store.

We plan to use another script tag to place the store's state when we're serializing the view, to avoid this workaround.

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

No branches or pull requests

2 participants