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

Prevent ReactComponent to serialize Props twice on one http request. #226

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@sfadeev
Copy link

sfadeev commented Feb 15, 2016

Small performance improvement to prevent ReactComponent to serialize Props twice on one http request:

  • first time on @Html.React call
  • second time on @Html.ReactInitJavaScript call
@Daniel15

This comment has been minimized.

Copy link
Member

Daniel15 commented Apr 18, 2016

The issue with this approach is that Props is not immutable. In theory it could be changed between the Html.React and Html.ReactInitJavaScript calls. Even though that's pretty silly, someone may be doing it in their code. I think instead, Props should have a custom setter that also sets the serialized props.

@Daniel15 Daniel15 closed this in cdaf737 Apr 18, 2016

@Daniel15

This comment has been minimized.

Copy link
Member

Daniel15 commented Apr 18, 2016

I used an alternate approach in cdaf737 (serialize the props in the setter rather than in GetComponentInitialiser. Thanks for the pull request though, it was a good inspiration :)

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