Skip to content

Commit 9c5ccb9

Browse files
committed
Merge branch 'master' of https://github.com/reactjs/react-rails
2 parents 81f7923 + e440628 commit 9c5ccb9

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ To use `react_ujs`, simply `require` it after `react` (and after `turbolinks` if
8484
//= require react_ujs
8585
```
8686

87-
### Viewer helper
87+
### View helper
8888

89-
There is a viewer helper method `react_component`. It is designed to work with `react_ujs` and takes a React class name, properties, and HTML options as arguments:
89+
There is a view helper method `react_component`. It is designed to work with `react_ujs` and takes a React class name, properties, and HTML options as arguments:
9090

9191
```ruby
9292
react_component('HelloMessage', :name => 'John')
@@ -125,7 +125,7 @@ In order for us to render your React components, we need to be able to find them
125125
//= require_tree ./components
126126
```
127127

128-
This will bring in all files located in the `app/assets/components` directory. You can organize your code however you like, as long as a request for `/assets/components.js` brings in a concatenated file containing all of your React components, and each one has to be available in the global scope (either `window` or `global` can be used). For `.js.jsx` files this is not a problem, but if you are using `.js.jsx.coffee` files then the wrapper function needs to be taken into account:
128+
This will bring in all files located in the `app/assets/javascripts/components` directory. You can organize your code however you like, as long as a request for `/assets/components.js` brings in a concatenated file containing all of your React components, and each one has to be available in the global scope (either `window` or `global` can be used). For `.js.jsx` files this is not a problem, but if you are using `.js.jsx.coffee` files then the wrapper function needs to be taken into account:
129129

130130
```coffee
131131
###* @jsx React.DOM ###

lib/assets/javascripts/react_ujs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
document.addEventListener(eventName, callback);
5858
}
5959
}
60-
handleEvent('page:load', mountReactComponents);
60+
handleEvent('page:change', mountReactComponents);
6161
handleEvent('page:before-change', unmountReactComponents);
6262
}
6363
})(document, window, React);

lib/react/rails/railtie.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Railtie < ::Rails::Railtie
2121

2222
# run after all initializers to allow sprockets to pick up react.js and
2323
# jsxtransformer.js from end-user to override ours if needed
24-
initializer "react_rails.setup_vendor", :after => "sprockets.environment" do |app|
24+
initializer "react_rails.setup_vendor", :after => "sprockets.environment", group: :all do |app|
2525
# Mimic behavior of ember-rails...
2626
# We want to include different files in dev/prod. The unminified builds
2727
# contain console logging for invariants and logging to help catch

react-rails.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
2323

2424
s.add_dependency 'execjs'
2525
s.add_dependency 'rails', '>= 3.1'
26-
s.add_dependency 'react-source', '0.9.0'
26+
s.add_dependency 'react-source', '0.10.0'
2727
s.add_dependency 'connection_pool'
2828

2929
s.files = Dir[

test/jsxtransform_test.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
(function() {
1515
var Component;
1616
17-
Component = React.createClass({
18-
displayName:'Component',
17+
Component = React.createClass({displayName: 'Component',
1918
render: function() {
2019
return ExampleComponent( {videos:this.props.videos} );
2120
}

test/view_helper_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ class ViewHelperTest < ActionDispatch::IntegrationTest
5858
page.click_link('Bob')
5959
assert page.has_content?('Hello Bob')
6060

61+
# Try going back.
62+
page.execute_script('history.back();')
63+
assert page.has_content?('Hello Alice')
64+
6165
# Try Turbolinks javascript API.
6266
page.execute_script('Turbolinks.visit("/pages/2");')
6367
assert page.has_content?('Hello Alice')

0 commit comments

Comments
 (0)