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

Any thoughts on hydrating data with SSR? #266

Open
ray-delossantos opened this issue Dec 8, 2019 · 3 comments
Open

Any thoughts on hydrating data with SSR? #266

ray-delossantos opened this issue Dec 8, 2019 · 3 comments

Comments

@ray-delossantos
Copy link

Hi:

Any thoughts on hydrating data when creating an SSR rendering. I'll love to have an express server generating on server side the complete view (Maybe i'll use puppeteer - https://github.com/puppeteer/puppeteer). Where should i hydrate the data? from my simple understading i believe something like this could work:

Moon.use({
    data: Moon.data.driver(window.ssr.moon.data || 1)
});

Moon.run(({ data }) => {
    console.log(data); // => 1
    return {};
});
@ray-delossantos ray-delossantos changed the title Any thoughts on hydrating data with SSR Any thoughts on hydrating data with SSR? Dec 8, 2019
@kbrsh
Copy link
Owner

kbrsh commented Dec 8, 2019

Something like that would work, but Moon doesn't currently support hydration and the view driver expects the root element to be empty. If hydration were to be added, would you prefer it being added before or after v1 stable is released?

@ray-delossantos
Copy link
Author

ray-delossantos commented Dec 8, 2019

I love the work you have been doing on the framework. Do you have a roadmap and a release date for the framework?. I'll love to have a view driver with hydrated data but is up to you to figure out the correct time for this implementation. I'll try to give opinions on missing features and maybe i could help a little bit, i'm just starting to grasp a lot of the functional programming concepts.

The feature could be something like:
https://reactjs.org/docs/react-dom-server.html

@kbrsh
Copy link
Owner

kbrsh commented Dec 9, 2019

Thank you! I'm not sure yet as it would require another driver that renders views to strings. Any feedback or help is greatly appreciated — I'd recommend you join the Slack if you haven't already. I can answer any questions or help with contributing if you'd like :)

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