-
-
Notifications
You must be signed in to change notification settings - Fork 629
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
Doc/xhr hydration examples #1095
Doc/xhr hydration examples #1095
Conversation
1 similar comment
<p> | ||
This example demonstrates client side manual rehydration after a component replacement through XHR.<br/><br/> | ||
|
||
The "Refresh" button on this page will trigger an asynchrounous refresh of component-container content.<br/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo on "asynchronous"
Components will be prerendered by the server and inserted in the DOM (spec/dummy/app/views/pages/xhr_refresh.js.erb)<br/> | ||
No client rehydration will occur, preventing any event handler to be correctly attached<br/><br/> | ||
|
||
Thus, the onChange handler of the HelloWorld component won't trigger whereas the one from HellowWorldRehydratable will, thanks to the "hydrate" javscript event dispacthed from xhr_refresh.js.erb<br /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo on "javascript"
Review status: 0 of 15 files reviewed at latest revision, 2 unresolved discussions. README.md, line 546 at r2 (raw file):
red dots mean extra spaces spec/dummy/app/assets/javascripts/jquery_rails_manifest.js, line 2 at r2 (raw file):
do we really need to use sprockets for jquery? spec/dummy/app/views/pages/xhr_refresh.html.erb, line 2 at r2 (raw file):
This should not be needed if we're using the rails/webpacker way. The jquery bits should be put into the webpacker tag. This is pre-webpacker: https://github.com/shakacode/react_on_rails/blob/master/spec/dummy_no_webpacker/app/views/layouts/application.html.erb#L19 This is post-webpacker: this is the post webpacker jquery: https://github.com/shakacode/react_on_rails/blob/master/spec/dummy/client/package.json#L27, spec/dummy/app/views/pages/xhr_refresh.html.erb, line 21 at r2 (raw file): Previously, hchevalier wrote…
yes, please fix typo! spec/dummy/app/views/pages/xhr_refresh.html.erb, line 25 at r2 (raw file): Previously, hchevalier wrote…
yes, fix! spec/dummy/client/app/components/HelloWorldRehydratable.js, line 48 at r2 (raw file):
get the script tag from just querying for the script tag with the where the definitely make sure all this JS passes the linter. Comments from Reviewable |
Changes requested. Review status: all files reviewed at latest revision, 6 unresolved discussions. Comments from Reviewable |
Review status: 9 of 14 files reviewed at latest revision, 4 unresolved discussions. README.md, line 546 at r2 (raw file): Previously, justin808 (Justin Gordon) wrote…
Done. spec/dummy/app/views/pages/xhr_refresh.html.erb, line 2 at r2 (raw file): Previously, justin808 (Justin Gordon) wrote…
Done. spec/dummy/app/assets/javascripts/jquery_rails_manifest.js, line 2 at r2 (raw file): Previously, justin808 (Justin Gordon) wrote…
Done. spec/dummy/client/app/components/HelloWorldRehydratable.js, line 48 at r2 (raw file): Previously, justin808 (Justin Gordon) wrote…
Done. Comments from Reviewable |
Some suggestions. Looking good. Review status: all files reviewed at latest revision, all discussions resolved. spec/dummy/client/app/startup/clientRegistration.jsx, line 4 at r3 (raw file):
Any explanation for the addition of these? I think we should use something like this for all of these:
spec/dummy/client/app/components/HelloWorldRehydratable.jsx, line 47 at r3 (raw file):
How can this be falsey for a React on Rails component? Comments from Reviewable |
Review status: 10 of 15 files reviewed at latest revision, 2 unresolved discussions. spec/dummy/client/app/startup/clientRegistration.jsx, line 4 at r3 (raw file): Previously, justin808 (Justin Gordon) wrote…
Done. spec/dummy/client/app/components/HelloWorldRehydratable.jsx, line 47 at r3 (raw file): Previously, justin808 (Justin Gordon) wrote…
Done. Comments from Reviewable |
Just one thing I see... Review status: all files reviewed at latest revision, all discussions resolved. spec/dummy/client/webpack.client.base.config.js, line 73 at r4 (raw file):
Why do we need to use $ for jQuery in example? I don't like it, as it the If you just want to let others know about this option, you can add a comment to the line above for jQuery to create a similar entry to expose Comments from Reviewable |
Review status: all files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
Review status: all files reviewed at latest revision, 1 unresolved discussion. README.md, line 545 at r5 (raw file):
Are you sure this link works? This will be done from the README.md so it might not. spec/dummy/client/app/components/HelloWorldRehydratable.jsx, line 43 at r5 (raw file):
The Comments from Reviewable |
Thanks @hchevalier! |
#921 (comment)
This change is