Skip to content

Add HtmlHelperExtension flag to turn off server side rendering #103

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

Merged
merged 2 commits into from
Mar 13, 2015
Merged

Add HtmlHelperExtension flag to turn off server side rendering #103

merged 2 commits into from
Mar 13, 2015

Conversation

jslatts
Copy link
Contributor

@jslatts jslatts commented Mar 12, 2015

I often find myself wanting/needing to disabled server-side rendering during development in order to use the Chrome debugger for troubleshooting javascript syntax issues and various React bugs/errors. My current process is to manually write out the client-side initialization code and commenting out the server-side helper:

<div id='temp></div>
React.render(React.createElement(CommentsBox, {"someJson": "blobl"}), document.getElementById("temp"));

This PR adds a flag that let's us instruct ReactJS.NET to simply render the client-side initialization code which can easily be turned off (back to server-side + client-side mode) when done debugging/developing.

If you don't think this is appropriate or would prefer it be implemented differently, just let me know.

jslatts

…erver-side render stage while still outputing client-side code. Useful for debugging and quicker dev cycles
@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

@jslatts
Copy link
Contributor Author

jslatts commented Mar 12, 2015

Hah. I just realized that PR #49 was for the same idea. Well, this is a simple implementation, no copy paste code, it has tests, and it works :) Let me know if you will accept it and I will sign the CLA.

{
Props = new { hello = "World" }
};
var result = component.RenderHtml(true); //renderContainerOnly = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use named arguments for boolean parameters. component.renderHtml(renderContainerOnly: true)

@Daniel15
Copy link
Member

Thanks, this looks pretty good! Please sign the CLA and fix the very minor comments and I'll be happy to merge this :)

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@jslatts
Copy link
Contributor Author

jslatts commented Mar 13, 2015

@Daniel15 alright! I addressed the two comments that I could and signed the CLA. Let me know if you need anything else.

Daniel15 added a commit that referenced this pull request Mar 13, 2015
Add HtmlHelperExtension flag to turn off server side rendering
@Daniel15 Daniel15 merged commit 7d80f64 into reactjs:master Mar 13, 2015
@Daniel15
Copy link
Member

Thanks!

@Daniel15 Daniel15 modified the milestones: 1.4, 1.4.1 Mar 13, 2015
@jslatts jslatts deleted the clientOnly branch October 16, 2015 16:18
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 this pull request may close these issues.

3 participants