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

Fails at choo's server side render #20

Open
graforlock opened this issue Jun 1, 2017 · 5 comments
Open

Fails at choo's server side render #20

graforlock opened this issue Jun 1, 2017 · 5 comments

Comments

@graforlock
Copy link

graforlock commented Jun 1, 2017

In the express environment the attempt of SSR rendering choo results in:

this._element.getAttribute is not a function

Workaround involves passing a mock function in the server side js context and importing the proper module from the client bundle endpoint. But its a hacky solution.

So, with code:

`<div>${geoMap.render({ longitude, latitude, markers, city }, emit)}</div>`

One has to pass down component in nodejs state environment as something like:

export default {
 render: () => ''
};

I believe its not a big fix to make this assumption dependant on the runtime context.

I realise this is probably more to do with nanocomponent but it fails in both places and I only wanted to create one issue ticket.

@yoshuawuyts
Copy link
Owner

yoshuawuyts commented Jun 1, 2017 via email

@graforlock
Copy link
Author

graforlock commented Sep 16, 2017

Ok, so it fails due to microcomponent wanting to get .attributes on the server (which isn't available):

https://github.com/yoshuawuyts/microcomponent/blob/master/index.js#L46

the fix is to replace the line with:

if (oldElement && oldElement.attributes) {

It then renders fine on server side.

@yoshuawuyts
Copy link
Owner

yoshuawuyts commented Sep 19, 2017 via email

@graforlock
Copy link
Author

graforlock commented Sep 19, 2017

Hmm okay. I did a cleanup as some folks are still using it and don't know it (including me (: ). Its closer to react mindset and some companies have mostly react devs that think and dream of this.props.

@yoshuawuyts
Copy link
Owner

yoshuawuyts commented Sep 19, 2017 via email

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