Allow Javascript engines to be bypassed entirely. #254

Merged
merged 1 commit into from Apr 18, 2016

Projects

None yet

3 participants

@dustinsoftware
Contributor

If no server-side rendering will occur on a page, for instance if
component render is called with clientOnly: true, it is
pointless to initialize a Javascript engine on the server. This allows the
consumer to easily disable all server side Javascript if the server is
under heavy load.

@dustinsoftware
Contributor

I see that I forgot to sign the CLA before submitting this PR - just did that.

@Daniel15
Member

Seems reasonable to me!

It looks like there's a number of "invisible" changes that aren't actually related to this diff (looks like it might be changing the line endings from \r\n to \n or vice versa. Could you please revert those? We can fix those up in a separate commit :)

@Daniel15 Daniel15 commented on an outdated diff Apr 18, 2016
src/React.AspNet/HtmlHelperExtensions.cs
#if LEGACYASPNET
-namespace React.Web.Mvc
+namespace React.Web.Mvc
@Daniel15
Daniel15 Apr 18, 2016 Member

I can't see any noticeable change in this line so it's probably replaced newlines (\r\n with \n or vice versa). Could you please revert all the lines that aren't directly related to your change?

@dustinsoftware
Contributor

Yeah, it looks like the line endings are mixed in some of the files and VS auto corrected them :) Fix pushed

@Daniel15
Member

It looks like a unit test is failing. Can you please take a look? https://ci.appveyor.com/project/Daniel15/react-net/build/108

Mvc\HtmlHelperExtensionsTests.cs(39,27): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\projects\react-net\src\React.Tests\React.Tests.csproj]
Mvc\HtmlHelperExtensionsTests.cs(64,27): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\projects\react-net\src\React.Tests\React.Tests.csproj]
Mvc\HtmlHelperExtensionsTests.cs(86,27): error CS0854: An expression tree may not contain a call or invocation that uses optional arguments [C:\projects\react-net\src\React.Tests\React.Tests.csproj]
Done Building Project "C:\projects\react-net\src\React.Tests\React.Tests.csproj" (Rebuild target(s)) -- FAILED.

You can run the dev-build.bat file which will build the project and run the unit tests. Please ensure the bundled example site (React.Sample.Mvc4) still works fine as well.

@dustinsoftware
Contributor

Fixed, sorry about that. I had been using the sample site to test before, but forgot to build solution before I pushed.

@dustinsoftware dustinsoftware Allow Javascript engines to be bypassed entirely.
If no server-side rendering will occur on a page, for instance if
component render is called with clientOnly: true, it is
pointless to initialize a Javascript engine on the server. This allows the
consumer to easily disable all server side Javascript if the server is
under heavy load.
e931f4e
@Daniel15
Member

Thanks 😄

@Daniel15 Daniel15 merged commit cf333b2 into reactjs:master Apr 18, 2016

1 check passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@dustinsoftware dustinsoftware deleted the dustinsoftware:client-rendering branch Apr 18, 2016
@dustinsoftware
Contributor

@Daniel15 would you mind publishing a package update so I can consume these changes?

@Daniel15
Member

Will try to do that soon :) In the meantime, you could use the latest development package (see http://reactjs.net/getting-started/download.html#development-builds)

@Daniel15
Member

This has been included in the 2.4 release (http://reactjs.net/2016/05/2.4.0-release.html). Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment