-
Notifications
You must be signed in to change notification settings - Fork 32
Conversation
It seems app.start always gets a fresh state object and not using whatever the server serialized with toString(): choojs/choo#141 |
Regarding choo's issue #141 that you mentioned about, it's actually not really choo's responsibility to rehydrate itself from the state that was passed into I want to pull this down and play with it before merging this PR to make sure its exactly what I want, am with the team and will do that in a few hours or maybe later tonight. |
@@ -1,14 +1,10 @@ | |||
const html = require('choo/html') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with moving /server/pages/archive/index to client/js/pages/... this app will not be truly isomorphic in the sense that it will be identical on server and client. We will have pieces that are server-rendered and pieces that are client-rendered from rehydration, and the only possible overlap might be certain states of the header, but for the most part the header should be rendered on the server, and so should the basic markup for the page-level template. So moving this to the client doesn't make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but i think we should diverge the render-ness logic in the component level rather than the entry-point to make things simpler. for example: the hyperdrive-ui bit can be rendering the html tree plus a tree object in server, while in client side it's rehydrated with yofs on the tree object, and connects to peer for updates. Does it make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I see your point! Put me down for +1 --> agree.
wow good looks like things are choo-ing along! |
right, it's a different issue to serialize whatever the store has after server-side rendering, and have that state populated in the client. this is often with a magic object injected during server rendering in the redux world: https://github.com/erikras/react-redux-universal-hot-example/blob/master/src/helpers/Html.js#L52 |
clkao: yes, that react example is exactly what (IMO) we should do (for now). it's kind of a hacky approach tho, and in the long term, we should rehydrate from an xhr call and aggressively cache the server-rendered templates (without the state object in them). I'll add that nice example you found to the parent issue about the rehydration. |
i don't think it's really hacky to do the |
Yeah, Yoshua and I were discussing this as well and I agreed with you, @juliangruber, but then Yoshua had a great point, which is that if we do xhr to rehydrate, we can then aggressively cache the page-level templates with a CDN. If you want to chime in, I started a discussion laying out the pros and cons in #163 |
… into migrate-header
weird -- Travis is reporting e2e tests failing, but I ran them locally twice and there is no problem. All passing. |
For the actions to work in universal environment, i think the rehydration needs to rerender everything so handlers with send() will work.
Closes #168.