-
Notifications
You must be signed in to change notification settings - Fork 59
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
Reduce lifecycle for Server Side Rendering #318
Comments
cc @Robert-Frampton |
Makes sense to me. One question I have, is what do we allow for people who want to use JSDom with their SSR? If we use metal's I think instead of checking with |
Having SSR to work out of the box would be great! I'm not a big fan of adding |
I agree with your suggestion @Robert-Frampton that seems to be reasonable to still support those lifecycles for projects that want to maintain that with JSDom |
Currently, the whole lifecycle is triggered on server side rendering causing a bunch of unexpected behaviors and sometimes requiring a lot of validations verifying if it's a client rendering.
For instance, React only triggers
componentWillMount
on SSR (https://reactjs.org/docs/react-component.html#componentwillmount)If a sub-component tries to change something on
rendered
andattached
it would cause unexpected behaviors.The function
getCurrentData
also gets a call on SSR, and looks like it should not.https://github.com/metal/metal.js/blob/master/packages/metal-incremental-dom/src/render/render.js#L114
On SSR
comp.element
doesn't exist, and the current code assumes it exists on that conditional.I suggest having the same behavior, just only lifecycle to be triggered before rendering. Maybe
willAttach
.The text was updated successfully, but these errors were encountered: