Skip to content

Commit 308a086

Browse files
committed
Merge branch 'master' into prep-for-2.6.1
2 parents d233bb4 + b1a6cc0 commit 308a086

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ gem 'react-rails'
7474
```
7575

7676
##### 3) Now run the installers:
77+
78+
###### Rails 6.x:
79+
```
80+
$ bundle install
81+
$ rails webpacker:install
82+
$ rails webpacker:install:react
83+
$ rails generate react:install
84+
```
85+
Note: For Rails 6, You don't need to add `javascript_pack_tag` as in Step 4. Since its already added by default.
86+
87+
###### Rails 5.x:
7788
```
7889
$ bundle install
7990
$ rails webpacker:install # OR (on rails version < 5.0) rake webpacker:install
@@ -658,7 +669,7 @@ yarn install
658669
### Undefined Set
659670
```
660671
ExecJS::ProgramError (identifier 'Set' undefined):
661-
672+
662673
(execjs):1
663674
```
664675
If you see any variation of this issue, see [Using TheRubyRacer](#using-therubyracer)
@@ -670,9 +681,11 @@ TheRubyRacer [hasn't updated LibV8](https://github.com/cowboyd/therubyracer/blob
670681
LibV8 itself is already [beyond version 7](https://github.com/cowboyd/libv8/releases/tag/v7.3.492.27.1) therefore many serverside issues are caused by old JS engines and fixed by using an up to date one such as [MiniRacer](https://github.com/discourse/mini_racer) or [TheRubyRhino](https://github.com/cowboyd/therubyrhino) on JRuby.
671682

672683
### HMR
673-
HMR is possible with this gem as it does just pass through to Webpacker. Please open an issue to let us know tips and tricks for it to add to the wiki.
684+
Hot Module Replacement is [possible with this gem](https://stackoverflow.com/a/54846330/193785) as it does just pass through to Webpacker. Please open an issue to let us know tips and tricks for it to add to the wiki.
685+
686+
Sample repo that shows HMR working with `react-rails`: [https://github.com/edelgado/react-rails-hmr](https://github.com/edelgado/react-rails-hmr)
674687

675-
One example: [Stack Overflow answer with Babel and Webpacker config](https://stackoverflow.com/a/54846330/193785)
688+
One caveat is that currently you [cannot Server-Side Render along with HMR](https://github.com/reactjs/react-rails/issues/925#issuecomment-415469572).
676689

677690
## Related Projects
678691

lib/react/jsx/sprockets_strategy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def attach_with_strategy(sprockets_env, strategy_or_nil)
2323
# @return [Symbol] based on the environment, return a method name to call with the sprockets environment
2424
def detect_strategy
2525
sprockets_version = Gem::Version.new(Sprockets::VERSION)
26-
if sprockets_version >= Gem::Version.new('4.x')
26+
if sprockets_version >= Gem::Version.new('4.a')
2727
:register_processors
2828
elsif sprockets_version >= Gem::Version.new('3.0.0')
2929
:register_engine_with_mime_type

react_ujs/src/events/turbolinks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ module.exports = {
22
// Turbolinks 5+ got rid of named events (?!)
33
setup: function(ujs) {
44
ujs.handleEvent('turbolinks:load', ujs.handleMount);
5-
ujs.handleEvent('turbolinks:before-render', ujs.handleMount);
5+
ujs.handleEvent('turbolinks:before-render', ujs.handleUnmount);
66
},
77

88
teardown: function(ujs) {
99
ujs.removeEvent('turbolinks:load', ujs.handleMount);
10-
ujs.removeEvent('turbolinks:before-render', ujs.handleMount);
10+
ujs.removeEvent('turbolinks:before-render', ujs.handleUnmount);
1111
},
1212
}

0 commit comments

Comments
 (0)