react_on_rails 5.1.0 → 5.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +8 -1
- data/README.md +10 -4
- data/app/helpers/react_on_rails_helper.rb +7 -4
- data/docs/tutorial.md +1 -2
- data/lib/generators/react_on_rails/templates/base/base/client/package.json.tt +0 -2
- 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: e3efe27cbce192ca2a3e8ee6e91255f47e68038c
|
4
|
+
data.tar.gz: bc035548f573a9060627f0f15b285016e963a0e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c2fa2400b5bc970578a1612435391d5423a005ce5ba971b767d7aaf9166b70f5ceef26cc47094da4a8343b3cc52e0833b64d6742ddd79bf375a951aeab558ff
|
7
|
+
data.tar.gz: a47fe80f1634269849eea0cdcbb694a775fc3f17e0420622ecdcb6d007915e9ee840729eb06aa3f65eb27efccf6f981be0af908d6345be5e34eb7e8e985989a5
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,12 @@ 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
|
+
## [5.1.1] - 2016-04-04
|
8
|
+
##### Fixed
|
9
|
+
- [Security] Address failure to sanitize console messages when server rendering and displaying in the browser console. See [#366](https://github.com/shakacode/react_on_rails/pull/366) and [#370](https://github.com/shakacode/react_on_rails/pull/370) by [justin808](https://github.com/justin808)
|
10
|
+
##### Added
|
11
|
+
- railsContext includes the port number and a boolean if the code is being run on the server or client.
|
12
|
+
|
7
13
|
## [5.1.0] - 2016-04-03
|
8
14
|
##### Added
|
9
15
|
All 5.1.0 changes can be found in [#362](https://github.com/shakacode/react_on_rails/pull/362) by [justin808](https://github.com/justin808).
|
@@ -262,7 +268,8 @@ Best done with Object destructing:
|
|
262
268
|
|
263
269
|
##### Fixed
|
264
270
|
- Fix several generator related issues.
|
265
|
-
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/5.1.
|
271
|
+
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/5.1.1...master
|
272
|
+
[5.1.1]: https://github.com/shakacode/react_on_rails/compare/5.0.0...5.1.1
|
266
273
|
[5.1.0]: https://github.com/shakacode/react_on_rails/compare/5.0.0...5.1.0
|
267
274
|
[5.0.0]: https://github.com/shakacode/react_on_rails/compare/4.0.3...5.0.0
|
268
275
|
[4.0.3]: https://github.com/shakacode/react_on_rails/compare/4.0.2...4.0.3
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
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
3
|
# NEWS
|
4
|
-
* 5.1.
|
4
|
+
* 5.1.1 has shipped! Please see the [CHANGELOG.md](./CHANGELOG.md) for details on the latest release and any breaking changes.
|
5
5
|
* [New slides on React on Rails](http://www.slideshare.net/justingordon/react-on-rails-v4032).
|
6
6
|
* 2016-02-28: We added a [Projects page](./PROJECTS.md) and a [Kudos page](./KUDOS.md). Please edit the page 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.
|
7
7
|
* *See [NEWS.md](NEWS.md) for the full news history.*
|
@@ -129,7 +129,7 @@ We're definitely not doing that. With react_on_rails, webpack is mainly generati
|
|
129
129
|
1. Add the following to your Gemfile and bundle install:
|
130
130
|
|
131
131
|
```ruby
|
132
|
-
gem "react_on_rails", "~>
|
132
|
+
gem "react_on_rails", "~> 5"
|
133
133
|
```
|
134
134
|
|
135
135
|
2. See help for the generator:
|
@@ -234,13 +234,19 @@ The `railsContext` has: (see implementation in file react_on_rails_helper.rb for
|
|
234
234
|
location: "#{uri.path}#{uri.query.present? ? "?#{uri.query}": ""}",
|
235
235
|
scheme: uri.scheme, # http
|
236
236
|
host: uri.host, # foo.com
|
237
|
+
port: uri.port,
|
237
238
|
pathname: uri.path, # /posts
|
238
239
|
search: uri.query, # id=30&limit=5
|
239
240
|
|
240
241
|
# Locale settings
|
241
242
|
i18nLocale: I18n.locale,
|
242
243
|
i18nDefaultLocale: I18n.default_locale,
|
243
|
-
httpAcceptLanguage: request.env["HTTP_ACCEPT_LANGUAGE"]
|
244
|
+
httpAcceptLanguage: request.env["HTTP_ACCEPT_LANGUAGE"],
|
245
|
+
|
246
|
+
# Other
|
247
|
+
serverSide: boolean # Are we being called on the server or client? NOTE, if you conditionally
|
248
|
+
# render something different on the server than the client, then React will only show the
|
249
|
+
# server version!
|
244
250
|
}
|
245
251
|
```
|
246
252
|
|
@@ -327,7 +333,7 @@ This is how you actually render the React components you exposed to `window` ins
|
|
327
333
|
+ **prerender:** enable server-side rendering of component. Set to false when debugging!
|
328
334
|
+ **id:** Id for the div. This will get assigned automatically if you do not provide an id.
|
329
335
|
+ **html_options:** Any other html options to get placed on the added div for the component.
|
330
|
-
+ **trace:** set to true to print additional debugging information in the browser. Defaults to true for development, off otherwise.
|
336
|
+
+ **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.
|
331
337
|
+ **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.
|
332
338
|
+ **raise_on_prerender_error:** Default is false. True will throw an error on the server side rendering. Your controller will have to handle the error.
|
333
339
|
|
@@ -250,7 +250,7 @@ module ReactOnRailsHelper
|
|
250
250
|
return render_value if @rendered_rails_context
|
251
251
|
|
252
252
|
data = {
|
253
|
-
rails_context: rails_context
|
253
|
+
rails_context: rails_context(server_side: false)
|
254
254
|
}
|
255
255
|
|
256
256
|
@rendered_rails_context = true
|
@@ -297,7 +297,7 @@ module ReactOnRailsHelper
|
|
297
297
|
|
298
298
|
wrapper_js = <<-JS
|
299
299
|
(function() {
|
300
|
-
var railsContext = #{rails_context.to_json};
|
300
|
+
var railsContext = #{rails_context(server_side: true).to_json};
|
301
301
|
#{initialize_redux_stores}
|
302
302
|
var props = #{props_string(props)};
|
303
303
|
return ReactOnRails.serverRenderReactComponent({
|
@@ -356,10 +356,10 @@ ReactOnRails.setStore('#{store_name}', store);
|
|
356
356
|
|
357
357
|
# This is the definitive list of the default values used for the rails_context, which is the
|
358
358
|
# second parameter passed to both component and store generator functions.
|
359
|
-
def rails_context
|
359
|
+
def rails_context(server_side:)
|
360
360
|
@rails_context ||= begin
|
361
361
|
uri = URI.parse(request.original_url)
|
362
|
-
# uri = URI("http://foo.com/posts?id=30&limit=5#time=1305298413")
|
362
|
+
# uri = URI("http://foo.com:3000/posts?id=30&limit=5#time=1305298413")
|
363
363
|
|
364
364
|
result = {
|
365
365
|
# URL settings
|
@@ -367,6 +367,7 @@ ReactOnRails.setStore('#{store_name}', store);
|
|
367
367
|
location: "#{uri.path}#{uri.query.present? ? "?#{uri.query}" : ''}",
|
368
368
|
scheme: uri.scheme, # http
|
369
369
|
host: uri.host, # foo.com
|
370
|
+
port: uri.port,
|
370
371
|
pathname: uri.path, # /posts
|
371
372
|
search: uri.query, # id=30&limit=5
|
372
373
|
|
@@ -382,6 +383,8 @@ ReactOnRails.setStore('#{store_name}', store);
|
|
382
383
|
end
|
383
384
|
result
|
384
385
|
end
|
386
|
+
|
387
|
+
@rails_context.merge(serverSide: server_side)
|
385
388
|
end
|
386
389
|
|
387
390
|
def raise_on_prerender_error_option(val)
|
data/docs/tutorial.md
CHANGED
@@ -27,10 +27,9 @@ vim Gemfile
|
|
27
27
|
Add this line to your Gemfile:
|
28
28
|
|
29
29
|
```
|
30
|
-
gem 'react_on_rails'
|
30
|
+
gem 'react_on_rails'
|
31
31
|
```
|
32
32
|
|
33
|
-
<img src="http://forum.shakacode.com/uploads/default/original/1X/fb2c41941cdc2b6cdfcc563f8a837a9cf5a51cec.png" width="482" height="113">
|
34
33
|
|
35
34
|
```
|
36
35
|
bundle
|
@@ -94,9 +94,7 @@
|
|
94
94
|
"css-loader": "^0.23.1",
|
95
95
|
<%- unless options.skip_js_linters? -%>
|
96
96
|
"eslint": "^2.6.0",
|
97
|
-
<%- unless options.skip_js_linters? -%>
|
98
97
|
"eslint-config-shakacode": "^4.0.0",
|
99
|
-
<%- end -%>
|
100
98
|
"eslint-plugin-react": "^4.2.3",
|
101
99
|
<%- end -%>
|
102
100
|
"express": "^4.13.4",
|
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: 5.1.
|
4
|
+
version: 5.1.1
|
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-04-
|
11
|
+
date: 2016-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|