react_on_rails 6.0.4 → 6.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0bf42a9bd046d436091230f44b00d30a370535a
4
- data.tar.gz: 64471f645d54ae12ed5aff700095d06ff5494f67
3
+ metadata.gz: 0788f76ba377f9773a8fe05a2f24329a56aac709
4
+ data.tar.gz: 43659ea16bea055eecdca7afa70f1d41d35eb622
5
5
  SHA512:
6
- metadata.gz: 5cbdfa80dc6e8f6bea71fdc365daf05efc9bc806d23424b68f40e800b6118f679b2c6f5beffbb47ca9f4ca3be5266711e6713af2b2f9464c66661c47e30f20d0
7
- data.tar.gz: 1015c16e17d9006a17f1abb02dd5255206744fa7887e962196bc9e8054a32e4c239d9bae0f9940656d0dd692b738b6927de93178c614cfaa6ca76c810f966ea4
6
+ metadata.gz: 9e49b9fa33618f592d207ec19f269d86a994d3d73f9eaf391955a46b2cc29cbbefed6dd19de38c1e5f26ec0fd9409d553691bedfedd444d18706aa467962f788
7
+ data.tar.gz: dd26c3be40e4b4b7c7b22f76bf13d92fb54ffdb5ed3d777f8eaed3ad8f65f3b4631a56511de5302adc1170e238eddd3f7662b81bee5e07167c090554902460ff
data/CHANGELOG.md CHANGED
@@ -5,9 +5,13 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [6.0.5]
9
+ ##### Added
10
+ - Added better error messages to avoid issues with shared redux stores [#470](https://github.com/shakacode/react_on_rails/pull/470).
11
+
8
12
  ## [6.0.4]
9
13
  ##### Fixed
10
- - Added polyfill for clearTimeout which is used by babel-polyfill.
14
+ - Added polyfill for clearTimeout which is used by babel-polyfill [#451](https://github.com/shakacode/react_on_rails/pull/451).
11
15
 
12
16
  ## [6.0.3]
13
17
  ##### Fixed
@@ -349,7 +353,8 @@ Best done with Object destructing:
349
353
  ##### Fixed
350
354
  - Fix several generator related issues.
351
355
 
352
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/6.0.4...master
356
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/6.0.5...master
357
+ [6.0.5]: https://github.com/shakacode/react_on_rails/compare/6.0.4...6.0.5
353
358
  [6.0.4]: https://github.com/shakacode/react_on_rails/compare/6.0.3...6.0.4
354
359
  [6.0.3]: https://github.com/shakacode/react_on_rails/compare/6.0.2...6.0.3
355
360
  [6.0.2]: https://github.com/shakacode/react_on_rails/compare/6.0.1...6.0.2
data/KUDOS.md CHANGED
@@ -18,3 +18,5 @@ https://twitter.com/ollieglass/status/713372606804729856
18
18
  ![2016-05-11_00-54-57](https://cloud.githubusercontent.com/assets/1118459/15178739/1549ec2a-1713-11e6-961c-dc064186fc69.png)
19
19
 
20
20
  ![2016-05-10_18-19-32](https://cloud.githubusercontent.com/assets/1118459/15170483/f00e344c-16e1-11e6-93f6-ded2637b227b.png)
21
+
22
+ ![2016-06-15_08-57-25](https://cloud.githubusercontent.com/assets/1118459/16093324/33077310-32d7-11e6-88f3-69aa73bd7d9f.png)
data/PROJECTS.md CHANGED
@@ -7,16 +7,17 @@
7
7
  * **[Madrone Analytics](http://madroneco.com/)**: The original client of [ShakaCode](http://www.shakacode.com) that led to the development of React on Rails, as described in [Fast Rich Client Rails Development With Webpack and the ES6 Transpiler](http://www.railsonmaui.com/blog/2014/10/03/integrating-webpack-and-the-es6-transpiler-into-an-existing-rails-project/).
8
8
  * **[Deliveroo](https://deliveroo.co.uk/)**: The leading food delivery site in Europe has gone live with React on Rails, with multi-lingual JavaScript support!
9
9
  ![2016-05-03_19-18-34](https://cloud.githubusercontent.com/assets/1118459/15027253/91fd151a-11de-11e6-93e3-720518995fe0.png)
10
- * **[Go Cubes](https://gocub.es)**: Chewable Coffee online store.
11
- ![2016-05-19_22-30-15](https://cloud.githubusercontent.com/assets/1118459/15421919/73d2c186-1e11-11e6-967d-a2592e639382.png)
12
- ![2016-05-10_19-44-47](https://cloud.githubusercontent.com/assets/1118459/15171130/b87248ba-16e7-11e6-9ce3-f9799061f23c.png)
10
+ * **[Nootrobox](https://nootrobox.com)**: Web ecommerce site for "biohacking" products.
11
+ * **[Airgoat](https://airgoat.com/)**: Marketplace for sneakers.
12
+ * **[Apprentus](https://www.apprentus.com/)**: A marketplace to find the best private teachers. Using react-on-rails from the homepage to infinity!
13
+ * **[Confident Financial Solutions](https://www.mycfsapp.com/)**: Auto Repair Financing to help people get back on the road and back to life.
14
+
13
15
 
14
16
  ## Commercial Products in Development
15
17
  * **[GuavaPass](https://guavapass.com/)**: Coaching client of [ShakaCode](http://www.shakacode.com) and React on Rails fan!
16
18
  * **Friends and Guests**, the signature product of [ShakaCode](http://www.shakacode.com), which is a "Social Network Connecting Hosts and Guests". *Coming soon!*
17
19
  * **[Pivotal Tracker](http://www.pivotaltracker.com/)**: The first (and most-loved) agile project management tool built on Rails. React on Rails has greatly simplified integration and workflow for our React components in Rails!
18
- * **[Confident Financial Solutions](https://www.mycfsapp.com/)**: Auto Repair Financing to help people get back on the road and back to life.
19
- * **[Apprentus](https://www.apprentus.com/)**: A marketplace to find the best private teachers. Using react-on-rails from the homepage to infinity!
20
+
20
21
 
21
22
  --------
22
23
 
data/README.md CHANGED
@@ -12,6 +12,7 @@ Aloha from Justin Gordon and the [ShakaCode](http://www.shakacode.com) Team! We
12
12
  * On Twitter, follow [@railsonmaui](https://twitter.com/railsonmaui) and [@shakacode](https://twitter.com/shakacode) for updates on releases.
13
13
 
14
14
  # NEWS
15
+ * 2016-06-13: 6.0.4 shipped with a critical fix regarding a missing polyfill for `clearTimeout`, used by babel-polyfill.
15
16
  * 2016-06-06: 6.0.2 shipped with a critical fix if you are fragment caching the server generated React.
16
17
  * *See [NEWS.md](NEWS.md) for more notes over time.*
17
18
 
@@ -157,7 +158,7 @@ That will install the latest version and update your package.json.
157
158
  ## How it Works
158
159
  The generator installs your webpack files in the `client` folder. Foreman uses webpack to compile your code and output the bundled results to `app/assets/webpack`, which are then loaded by sprockets. These generated bundle files have been added to your `.gitignore` for your convenience.
159
160
 
160
- Inside your Rails views, you can now use the `react_component` helper method provided by React on Rails. You can pass props directly to the react component helper. You can also initialize a Redux store with view helper `redux_store` so that the store can be shared amongst multiple React components. Your best bet is to scan the code inside of the [/spec/dummy](spec/dummy) sample app.
161
+ Inside your Rails views, you can now use the `react_component` helper method provided by React on Rails. You can pass props directly to the react component helper. You can also initialize a Redux store with view or controller helper `redux_store` so that the store can be shared amongst multiple React components. See the docs for `redux_store` below and scan the code inside of the [/spec/dummy](spec/dummy) sample app.
161
162
 
162
163
  ### Client-Side Rendering vs. Server-Side Rendering
163
164
  In most cases, you should use the `prerender: false` (default behavior) with the provided helper method to render the React component from your Rails views. In some cases, such as when SEO is vital or many users will not have JavaScript enabled, you can enable server-rendering by passing `prerender: true` to your helper, or you can simply change the default in `config/initializers/react_on_rails`.
@@ -324,9 +325,13 @@ Include the module ReactOnRails::Controller in your controller, probably in Appl
324
325
  2. In your component definition, you'll call `ReactOnRails.getStore('storeName')` to get the hydrated Redux store to attach to your components.
325
326
  + **props:** Named parameter `props`. ReactOnRails takes care of setting up the hydration of your store with props from the view.
326
327
 
327
- For an example, see [spec/dummy/app/controllers/pages_controller.rb](spec/dummy/app/controllers/pages_controller.rb).
328
+ For an example, see [spec/dummy/app/controllers/pages_controller.rb](spec/dummy/app/controllers/pages_controller.rb). Note, this is preferable to using the equivalent view_helper `redux_store` in that you can be assured that the store is initialized before your components.
328
329
 
329
330
  #### View Helper
331
+ `redux_store(store_name, props: {})`
332
+
333
+ Same API as the controller extension. **HOWEVER**, we recommend the controller extension instead because the Rails executes the template code in the controller action's view file (`erb`, `haml`, `slim`, etc.) before the layout. So long as you call `redux_store` at the beginning of your action's view file, this will work. However, it's an easy mistake to put this call in the wrong place. Calling `redux_store` in the controller action ensures proper load order, regardless of where you call this in the controller action. Note, you won't know of this subtle ordering issue until you server render and you find that your store is not hydrated properly.
334
+
330
335
  `redux_store_hydration_data`
331
336
 
332
337
  Place this view helper (no parameters) at the end of your shared layout. This tell ReactOnRails where to client render the redux store hydration data. Since we're going to be setting up the stores in the controllers, we need to know where on the view to put the client side rendering of this hydration data, which is a hidden div with a matching class that contains a data props. For an example, see [spec/dummy/app/views/layouts/application.html.erb](spec/dummy/app/views/layouts/application.html.erb).
@@ -5,9 +5,23 @@ The generator has created the necessary files and gems for deployment to Heroku.
5
5
  + `12factor` gem: required by Heroku
6
6
  + `'puma'` gem: recommended Heroku webserver
7
7
  + `config/puma.rb`: Puma webserver config file
8
- + `lib/tasks/assets.rake`: This rake task file is provided by the generator regardless of whether the user chose Heroku Deployment as an option. It is highlighted here because it is helpful to understand that this task is what generates your JavaScript bundles in production.
9
-
8
+ + `lib/tasks/assets.rake`: This rake task file is provided by the generator regardless of whether the user chose Heroku Deployment as an option. It is highlighted here because it is helpful to understand that this task is what generates your JavaScript bundles in production. Previously, users of this gem had to create a file `lib/tasks/assets.rake` to modify the Rails precompile task to deploy assets for production. However, we add this automatically in newer versions of React on Rails. If you need to customize this file, see [lib/tasks/assets.rake from React on Rails](https://github.com/shakacode/react_on_rails/blob/master/lib/tasks/assets.rake) as an example.
10
9
 
10
+ ## More details on precompilation using webpack to create JavaScript assets
11
+ This is how the rake task gets modified. You should be able to call `clear_prerequisites` and setup your own custom precompile if needed.
12
+ ```ruby
13
+ # These tasks run as pre-requisites of assets:precompile.
14
+ # Note, it's not possible to refer to ReactOnRails configuration values at this point.
15
+ Rake::Task["assets:precompile"]
16
+ .clear_prerequisites
17
+ .enhance([:environment, "react_on_rails:assets:compile_environment"])
18
+ .enhance do
19
+ Rake::Task["react_on_rails:assets:symlink_non_digested_assets"].invoke
20
+ Rake::Task["react_on_rails:assets:delete_broken_symlinks"].invoke
21
+ end
22
+ ```
23
+
24
+ ## Caching Node Modules
11
25
  By default Heroku will cache the root `node_modules` directory between deploys but since we're installing in `client/node_modules` you'll need to add the following line to the `package.json` in your root directory (otherwise you'll have to sit through a full `npm install` on each deploy):
12
26
 
13
27
  ```js
@@ -15,7 +15,7 @@ const RouterApp = (props, railsContext) => {
15
15
  // create your hydrated store
16
16
  const store = createStore(props);
17
17
 
18
- // See https://github.com/reactjs/react-router/blob/master/docs/guides/advanced/ServerRendering.md
18
+ // See https://github.com/reactjs/react-router/blob/master/docs/guides/ServerRendering.md
19
19
  match({ routes, location }, (_error, _redirectLocation, _routeProps) => {
20
20
  error = _error;
21
21
  redirectLocation = _redirectLocation;
@@ -27,6 +27,6 @@ The only requirements within this directory for basic React on Rails integration
27
27
  1. Configure your top level JavaScript files for inclusion in your layout. You'll want a version that you use for static assets, and you want a file for any files in your setup that are not part of your webpack build. The reason for this is for use with hot-reloading. If you are not using hot reloading, then you only need to configure your `application.js` file to include your Webpack generated files. For more information on hot reloading, see [Hot Reloading of Assets For Rails Development](hot-reloading-rails-development.md)
28
28
 
29
29
  1. Configure your `lib/tasks/assets.rake` file to run webpack during asset precompilation.
30
- 1. If you are deploying to Heroku, see [heroku-deployment.md](heroku-deployment.md)
30
+ 1. If you are deploying to Heroku, see [heroku-deployment.md](/docs/additional-reading/heroku-deployment.md)
31
31
 
32
32
  If I missed anything, please submit a PR or file an issue.
@@ -1,2 +1,2 @@
1
- web: rails s
1
+ web: rails s -p 3000
2
2
  client: sh -c 'rm app/assets/webpack/* || true && cd client && npm run build:development'
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ReactOnRails
3
- VERSION = "6.0.4".freeze
3
+ VERSION = "6.0.5".freeze
4
4
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "6.0.4",
3
+ "version": "6.0.5",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.4
4
+ version: 6.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-13 00:00:00.000000000 Z
11
+ date: 2016-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool