Skip to content

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

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
wants to merge 1 commit into from

Conversation

sfadeev
Copy link

@sfadeev 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
Copy link
Member

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
Copy link
Member

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants