react_on_rails 6.0.1 → 6.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/NEWS.md +2 -1
- data/README.md +12 -11
- data/app/helpers/react_on_rails_helper.rb +1 -10
- data/lib/react_on_rails/react_component/options.rb +4 -7
- data/lib/react_on_rails/version.rb +1 -1
- data/package.json +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3f17df25c652f79c9d0cdcd0c1eddce4f95a4b5
|
4
|
+
data.tar.gz: 66c4677132c33fef5bb89e910c1eec4bad9aff74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4fd4a9a1e77b75619bae1367c895f69649e097771678b64e6d24a52f2807a34d2c8b5b351ec66f8c0add94e5aa5aa5130e4f3ca1fa73269fc2809678540235c
|
7
|
+
data.tar.gz: 5531be7c1597d4374020b1cae591dbf05a5cc4767d2e4f52d1c299674674b1505107bb1a6563bfc0e81291b4d44ced63393539ac484e3646e31eeb88c7a4ab49
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. Items under
|
|
4
4
|
Contributors: please follow the recommendations outlined at [keepachangelog.com](http://keepachangelog.com/). Please use the existing headings and styling as a guide, and add a link for the version diff at the bottom of the file. Also, please update the `Unreleased` link to compare to the latest release version.
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
+
## [6.0.2]
|
8
|
+
##### Fixed
|
9
|
+
- Fix colisions in ids of DOM nodes generated by `react_component` by indexing in using an UUID rather than an auto-increment value. This means that it should be overriden using the `id` parameter of `react_component` if one wants to generate a predictable id (_e.g._ for testing purpose). See [Issue #437](https://github.com/shakacode/react_on_rails/issues/437). Fixed in [#438](https://github.com/shakacode/react_on_rails/pull/438) by [Michael Baudino](https://github.com/michaelbaudino).
|
10
|
+
|
7
11
|
## [6.0.1]
|
8
12
|
##### Fixed
|
9
13
|
- Allow for older version of manifest.json for older versions of sprockets. See [Issue #435](https://github.com/shakacode/react_on_rails/issues/435). Fixed in [#436](https://github.com/shakacode/react_on_rails/pull/436) by [alleycat-at-git](https://github.com/alleycat-at-git).
|
@@ -336,7 +340,8 @@ Best done with Object destructing:
|
|
336
340
|
##### Fixed
|
337
341
|
- Fix several generator related issues.
|
338
342
|
|
339
|
-
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/6.0.
|
343
|
+
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/6.0.2...master
|
344
|
+
[6.0.2]: https://github.com/shakacode/react_on_rails/compare/6.0.1...6.0.2
|
340
345
|
[6.0.1]: https://github.com/shakacode/react_on_rails/compare/6.0.0...6.0.1
|
341
346
|
[6.0.0]: https://github.com/shakacode/react_on_rails/compare/5.2.0...6.0.0
|
342
347
|
[5.2.0]: https://github.com/shakacode/react_on_rails/compare/5.1.1...5.2.0
|
data/NEWS.md
CHANGED
@@ -3,8 +3,9 @@
|
|
3
3
|
*We'll keep a history of the news. A few bullets at the top will also show on the [README.md](./README.md).*
|
4
4
|
|
5
5
|
* Always see the [CHANGELOG.md](./CHANGELOG.md) for the latest project changes.
|
6
|
-
|
6
|
+
* 2016-05-24: 6.0.0 Released! Simplified generator and install process! See the [CHANGELOG.md](./CHANGELOG.md) for details.
|
7
7
|
* 2016-04-08: 5.2.0 Released! Support for React 15.0 and updates to the Generator.
|
8
|
+
* 2016-03-18: [Slides on React on Rails](http://www.slideshare.net/justingordon/react-on-rails-v4032).
|
8
9
|
* 2016-03-17: **4.0.3** Shipped! Includes using the new Heroku buildpack steps, several smaller changes detailed in the [CHANGELOG.md](./CHANGELOG.md).
|
9
10
|
* 2016-03-17: **4.0.2** Shipped! Includes using the new Heroku buildpack steps.
|
10
11
|
* Better support for hot reloading of assets from Rails with new helpers and updates to the sample testing app, [spec/dummy](spec/dummy).
|
data/README.md
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/shakacode/react_on_rails.svg?branch=master)](https://travis-ci.org/shakacode/react_on_rails) [![Dependency Status](https://gemnasium.com/shakacode/react_on_rails.svg)](https://gemnasium.com/shakacode/react_on_rails) [![Gem Version](https://badge.fury.io/rb/react_on_rails.svg)](https://badge.fury.io/rb/react_on_rails) [![npm version](https://badge.fury.io/js/react-on-rails.svg)](https://badge.fury.io/js/react-on-rails) [![Code Climate](https://codeclimate.com/github/shakacode/react_on_rails/badges/gpa.svg)](https://codeclimate.com/github/shakacode/react_on_rails) [![Coverage Status](https://coveralls.io/repos/shakacode/react_on_rails/badge.svg?branch=master&service=github)](https://coveralls.io/github/shakacode/react_on_rails?branch=master)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
* 2016-03-18: [Slides on React on Rails](http://www.slideshare.net/justingordon/react-on-rails-v4032).
|
6
|
-
* 2016-02-28: We added a [Projects page](./PROJECTS.md) and a [Kudos page](./KUDOS.md). Please edit the page and add your project or [email us](mailto:contact@shakacode.com) and we'll add you. We also love stars as it helps us attract new users and contributors. Also, see [Positive Feedback](https://github.com/shakacode/react_on_rails/issues/347) for screen grabs of nice comments!
|
7
|
-
* *See [NEWS.md](NEWS.md) for more notes over time.*
|
3
|
+
|
4
|
+
Aloha from Justin Gordon and the [ShakaCode](http://www.shakacode.com) Team! We need your help. Venture capital funding has slowed and, for the first time, my ShakaCode team is actively looking for our next project. If you like **React on Rails**, please consider contacting me if we could potentially help you in any way. I'm offering a free half hour project consultation, on anything from React on Rails to any aspect of web application development, including both consumer and enterprise products. You can read more about my background [here](http://www.railsonmaui.com/about). Whether you have a new project, or need help on an existing project, please email me directly at [justin@shakacode.com](mailto:justin@shakacode.com). And thanks in advance for any referrals! Your support keeps this project going.
|
8
5
|
|
9
6
|
# NOTES
|
10
|
-
*
|
11
|
-
* [
|
12
|
-
*
|
13
|
-
*
|
14
|
-
* See [Projects](PROJECTS.md) using and [KUDOS](./KUDOS.md) for React on Rails. Please submit yours!
|
7
|
+
* Besides consulting on bigger projects, [ShakaCode](http://www.shakacode.com) is doing Skype plus Slack/Github based coaching for "React on Rails". [Click here](http://www.shakacode.com/work/index.html) for more information.
|
8
|
+
* See our article [The React on Rails Doctrine](https://medium.com/@railsonmaui/the-react-on-rails-doctrine-3c59a778c724) and see [slides on React on Rails](http://www.slideshare.net/justingordon/react-on-rails-v4032).
|
9
|
+
* For a complete example, see the [React Webpack Rails Tutorial Code](https://github.com/shakacode/react-webpack-rails-tutorial) along with the live example at [www.reactrails.com](http://www.reactrails.com).
|
10
|
+
* The generator of React on Rails does not setup CSS modules and hot reloading via the Rails server as is demonstrated in the [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/). *We do support this, but we don't generate the code.* If you did generate a fresh app from react_on_rails and want to move to CSS Modules, then see [PR 175: Babel 6 / CSS Modules / Rails hot reloading](https://github.com/shakacode/react-webpack-rails-tutorial/pull/175). Note, while there are probably fixes after this PR was accepted, this has the majority of the changes. See [the tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/#news) for more information. For more information on how to setup hot reloading in a Rails app, see [Hot Reloading of Assets For Rails Development](docs/additional-reading/hot-reloading-rails-development.md).
|
11
|
+
* See [Projects](PROJECTS.md) using and [KUDOS](./KUDOS.md) for React on Rails. Please submit yours! Please edit either page or [email us](mailto:contact@shakacode.com) and we'll add your info. We also **love stars** as it helps us attract new users and contributors.
|
15
12
|
* On Twitter, follow [@railsonmaui](https://twitter.com/railsonmaui) and [@shakacode](https://twitter.com/shakacode) for updates on releases.
|
16
13
|
|
14
|
+
# NEWS
|
15
|
+
* 2016-06-06: 6.0.2 shipped with a critical fix if you are fragment caching the server generated React.
|
16
|
+
* *See [NEWS.md](NEWS.md) for more notes over time.*
|
17
|
+
|
17
18
|
# React on Rails
|
18
19
|
|
19
20
|
**Project Objective**: To provide an opinionated and optimal framework for integrating **Ruby on Rails** with modern JavaScript tooling and libraries, including [**Webpack**](http://webpack.github.io/), [**Babel**](https://babeljs.io/), [**React**](https://facebook.github.io/react/), [**Redux**](https://github.com/reactjs/redux), [**React-Router**](https://github.com/reactjs/react-router). This differs significantly from typical Rails. When considering what goes into **react_on_rails**, we ask ourselves, is the functionality related to the intersection of using Rails and with modern JavaScript? If so, then the functionality belongs right here. In other cases, we're releasing separate npm packages or Ruby gems. If you are interested in implementing React using traditional Rails architecture, see [react-rails](https://github.com/reactjs/react-rails).
|
@@ -306,7 +307,7 @@ react_component(component_name,
|
|
306
307
|
+ **options:**
|
307
308
|
+ **props:** Ruby Hash which contains the properties to pass to the react object, or a JSON string. If you pass a string, we'll escape it for you.
|
308
309
|
+ **prerender:** enable server-side rendering of component. Set to false when debugging!
|
309
|
-
+ **id:** Id for the div. This will get assigned automatically if you do not provide an id.
|
310
|
+
+ **id:** Id for the div, will be used to attach the React component. This will get assigned automatically if you do not provide an id. Must be unique.
|
310
311
|
+ **html_options:** Any other html options to get placed on the added div for the component.
|
311
312
|
+ **trace:** set to true to print additional debugging information in the browser. Defaults to true for development, off otherwise. Note, on the client you will so both the railsContext and your props. On the server, you only see the railsContext being logged.
|
312
313
|
+ **replay_console:** Default is true. False will disable echoing server-rendering logs to the browser. While this can make troubleshooting server rendering difficult, so long as you have the default configuration of logging_on_server set to true, you'll still see the errors on the server.
|
@@ -95,12 +95,8 @@ module ReactOnRailsHelper
|
|
95
95
|
# Create the JavaScript setup of the global to initialize the client rendering
|
96
96
|
# (re-hydrate the data). This enables react rendered on the client to see that the
|
97
97
|
# server has already rendered the HTML.
|
98
|
-
# We use this react_component_index in case we have the same component multiple times on the page.
|
99
98
|
|
100
|
-
|
101
|
-
options = ReactOnRails::ReactComponent::Options.new(name: component_name,
|
102
|
-
index: react_component_index,
|
103
|
-
options: raw_options)
|
99
|
+
options = ReactOnRails::ReactComponent::Options.new(name: component_name, options: raw_options)
|
104
100
|
|
105
101
|
# Setup the page_loaded_js, which is the same regardless of prerendering or not!
|
106
102
|
# The reason is that React is smart about not doing extra work if the server rendering did its job.
|
@@ -253,11 +249,6 @@ module ReactOnRailsHelper
|
|
253
249
|
prepend_render_rails_context(result)
|
254
250
|
end
|
255
251
|
|
256
|
-
def next_react_component_index
|
257
|
-
@react_component_index ||= -1
|
258
|
-
@react_component_index += 1
|
259
|
-
end
|
260
|
-
|
261
252
|
def props_string(props)
|
262
253
|
props.is_a?(String) ? props : props.to_json
|
263
254
|
end
|
@@ -4,11 +4,8 @@ module ReactOnRails
|
|
4
4
|
NO_PROPS = {}.freeze
|
5
5
|
HIDDEN = "display:none".freeze
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
def initialize(name:, index:, options:)
|
7
|
+
def initialize(name:, options:)
|
10
8
|
@name = name
|
11
|
-
@index = index
|
12
9
|
@options = options
|
13
10
|
end
|
14
11
|
|
@@ -21,7 +18,7 @@ module ReactOnRails
|
|
21
18
|
end
|
22
19
|
|
23
20
|
def dom_id
|
24
|
-
options.fetch(:id) {
|
21
|
+
@dom_id ||= options.fetch(:id) { generate_unique_dom_id }
|
25
22
|
end
|
26
23
|
|
27
24
|
def html_options
|
@@ -62,8 +59,8 @@ module ReactOnRails
|
|
62
59
|
|
63
60
|
attr_reader :options
|
64
61
|
|
65
|
-
def
|
66
|
-
"#{@name}-react-component-#{
|
62
|
+
def generate_unique_dom_id
|
63
|
+
"#{@name}-react-component-#{SecureRandom.uuid}"
|
67
64
|
end
|
68
65
|
|
69
66
|
def retrieve_key(key)
|
data/package.json
CHANGED
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
|
+
version: 6.0.2
|
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-
|
11
|
+
date: 2016-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|