-
-
Notifications
You must be signed in to change notification settings - Fork 631
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
Use <script type="application/json"> for props and store #775
Conversation
…ribute Initial implementation by Elias Lopez Gutierrez <[email protected]>
This reverts commit 8492f0e.
…ing the both cases
38b5f77
to
2486892
Compare
Looks excellent! Just a couple small comments. Reviewed 13 of 17 files at r1, 2 of 4 files at r2. lib/react_on_rails/react_component/options.rb, line 9 at r2 (raw file):
I think we can remove HIDDEN lib/react_on_rails/react_component/options.rb, line 57 at r2 (raw file):
We can probably remove spec/dummy/spec/helpers/react_on_rails_helper_spec.rb, line 62 at r2 (raw file):
You can break the string with spec/dummy/spec/helpers/react_on_rails_helper_spec.rb, line 93 at r2 (raw file):
try to avoid if possible Comments from Reviewable |
@cheremukhin23: CI failures:
|
Review status: 14 of 15 files reviewed at latest revision, 4 unresolved discussions. spec/dummy/spec/helpers/react_on_rails_helper_spec.rb, line 62 at r2 (raw file): Previously, justin808 (Justin Gordon) wrote…
Deleted rubocop exclusions and formatted string. Since we use squish on string, we can just format the string to be readable spec/dummy/spec/helpers/react_on_rails_helper_spec.rb, line 93 at r2 (raw file): Previously, justin808 (Justin Gordon) wrote…
Deleted rubocop exclusion Comments from Reviewable |
Review status: 13 of 15 files reviewed at latest revision, 4 unresolved discussions. lib/react_on_rails/react_component/options.rb, line 9 at r2 (raw file): Previously, justin808 (Justin Gordon) wrote…
Removed it lib/react_on_rails/react_component/options.rb, line 57 at r2 (raw file): Previously, justin808 (Justin Gordon) wrote…
Removed it spec/dummy/spec/helpers/react_on_rails_helper_spec.rb, line 62 at r2 (raw file): Previously, cheremukhin23 (Dmitriy Cheremukhin) wrote…
Changed format to single quotes and \ spec/dummy/spec/helpers/react_on_rails_helper_spec.rb, line 93 at r2 (raw file): Previously, cheremukhin23 (Dmitriy Cheremukhin) wrote…
Changed format to single quotes and \ Comments from Reviewable |
Currently CI fails because the lib can't handle props: @app_props_server_render.to_json , only props: @app_props_server_render. It seems it happens because of code in clientStartup.js. |
@justin808 All checks pass now |
One really important comment:
Reviewed 4 of 4 files at r4. node_package/src/clientStartup.js, line 101 at r4 (raw file):
I think that the conversion of the string JSON props to an object should happen on the Rails side, so that there's no need to double parse on the client side. We also need a unit test to confirm that a XSS cannot be introduced if the JSON string is passed, rather than object. Comments from Reviewable |
Moved this part to the Rails side Review status: 11 of 15 files reviewed at latest revision, 3 unresolved discussions. node_package/src/clientStartup.js, line 101 at r4 (raw file): Previously, justin808 (Justin Gordon) wrote…
Moved it to the rails side to ReactOnRails::ReactComponent::Options. Now we parse all incoming props to hash. Wrote test to ensure we have sanitized react component after passing props as json string Comments from Reviewable |
@justin808 Should work after build is passed. Any comments on last improvements? |
1 similar comment
Looks EXCELLENT! We just need the CHANGELOG.md entry and I'll release this. Reviewed 4 of 4 files at r5. Comments from Reviewable |
Reviewed 1 of 1 files at r6. Comments from Reviewable |
Hi, sorry for disappearance. I've upgraded my project to react-on-rails to 6.9.2 and tested, it works perfectly. Thanks for finishing that! |
@squadette Please update to 6.9.3! |
See discussion in #760
Change code according to unresolved discussions in #760
This change is