Skip to content

Html.ReactInitJavaScript() outputs server only components in initialization code #340

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

Closed
heinzmuller opened this issue Oct 25, 2016 · 5 comments

Comments

@heinzmuller
Copy link

heinzmuller commented Oct 25, 2016

Using @Html.React("Component", ..., serverOnly: true) still adds the ReactDOM.render() calls to the @Html.ReactInitJavaScript() output which breaks pages using server only components. (It also wraps the output in an unnecessary container element)

Looking through the code there seems to be missing a bool in the ReactEnvironment CreateComponent method that sets the component to be server only and thus skipped when outputting the init code for all components

@scokmen
Copy link

scokmen commented Nov 28, 2016

I encountered the same problem. The parameter serverOnly don't work.

@heinzmuller
Copy link
Author

I don't think this would be that difficult to "fix", but it would be nice to know if this is indeed a bug/problem or if I have misunderstood the parameter before I attempt to fix it with a PR

@heinzmuller
Copy link
Author

Any input on this @Daniel15 ?

@Daniel15
Copy link
Member

Interesting, this does sound like a bug to me. Feel free to submit a pull request if you like 😃

@DaniilSokolyuk
Copy link
Contributor

+1, parameter serverOnly don't work.
append hydrate to ReactInitJavaScript

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

Successfully merging a pull request may close this issue.

5 participants