react-rails 2.4.2 → 2.4.3

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: 47811f17053f671c8511622eee8e9df956613821
4
- data.tar.gz: 763dfb23708e0ba58c1ce85b759b544afef20e0b
3
+ metadata.gz: 871c8935efe49325b78955b744dd749664078a23
4
+ data.tar.gz: 5c14ae74ab1c66edf2eafb95b7d7427a7c7f1b4e
5
5
  SHA512:
6
- metadata.gz: 85bc51014a6313d578fb248cc1909b6cce1a0a67414711d4123529d8a5e7d475bb1790acf36bb14d0b95885128239f86dbfdd00697bd6055f8e7e607ab6e8909
7
- data.tar.gz: 02fa508f9b56c73e974da5eb502ca2dec8cbff7e92a5e117fd60b384f51232c5c59364af598283c5d5e5a1bfb50d9a3fc7d2821d831ebf784d3a44334894a701
6
+ metadata.gz: 4928107a478a44c2afa03db3a71e3eb2fb0888d0835f047b254c93fc63e7236021f6ee1392041a1cd5632d8922bf30f1d10e25ff9d3a68bd9b8c83d4ce3201ff
7
+ data.tar.gz: 1a49da7b4ccfe06517e37bbf520233a51eb528351bca4ace5abbadead5e918c4ee2e6b18cf4c6d7f82d58f4f64d641bddfdf1e91abd4cce375b9382a6afdf100
@@ -1,5 +1,17 @@
1
1
  # react-rails
2
2
 
3
+ #### Breaking Changes
4
+
5
+ #### New Features
6
+
7
+ #### Deprecation
8
+
9
+ #### Bug Fixes
10
+
11
+ ## 2.4.3
12
+ #### Bug Fixes
13
+ - Call ReactDOM.render() when react_component :prerender option is falsy, instead of ReactDOM.hydrate() #844, #842
14
+
3
15
  ## 2.4.2
4
16
  #### Bug Fixes
5
17
  - ReactDOM.hydrate() may not be defined for everyone, it will now use hydrate if it is defined or fallback to render #832
@@ -240,6 +240,9 @@ var ReactRailsUJS = {
240
240
  // example: `data-react-props="{\"item\": { \"id\": 1, \"name\": \"My Item\"} }"`
241
241
  PROPS_ATTR: 'data-react-props',
242
242
 
243
+ // This attribute holds which method to use between: ReactDOM.hydrate, ReactDOM.render
244
+ RENDER_ATTR: 'data-hydrate',
245
+
243
246
  // If jQuery is detected, save a reference to it for event handlers
244
247
  jQuery: (typeof window !== 'undefined') && (typeof window.jQuery !== 'undefined') && window.jQuery,
245
248
 
@@ -307,6 +310,7 @@ var ReactRailsUJS = {
307
310
  var constructor = ujs.getConstructor(className);
308
311
  var propsJson = node.getAttribute(ujs.PROPS_ATTR);
309
312
  var props = propsJson && JSON.parse(propsJson);
313
+ var hydrate = node.getAttribute(ujs.RENDER_ATTR);
310
314
 
311
315
  if (!constructor) {
312
316
  var message = "Cannot find component: '" + className + "'"
@@ -315,7 +319,7 @@ var ReactRailsUJS = {
315
319
  }
316
320
  throw new Error(message + ". Make sure your component is available to render.")
317
321
  } else {
318
- if (typeof ReactDOM.hydrate === "function") {
322
+ if (hydrate && typeof ReactDOM.hydrate === "function") {
319
323
  ReactDOM.hydrate(React.createElement(constructor, props), node);
320
324
  } else {
321
325
  ReactDOM.render(React.createElement(constructor, props), node);
@@ -39,6 +39,7 @@ module React
39
39
  html_options[:data].tap do |data|
40
40
  data[:react_class] = name
41
41
  data[:react_props] = (props.is_a?(String) ? props : props.to_json)
42
+ data[:hydrate] = 't' if prerender_options
42
43
  end
43
44
  end
44
45
  html_tag = html_options[:tag] || :div
@@ -2,6 +2,6 @@ module React
2
2
  module Rails
3
3
  # If you change this, make sure to update VERSIONS.md
4
4
  # and republish the UJS by updating package.json and `bundle exec rake ujs:publish`
5
- VERSION = '2.4.2'
5
+ VERSION = '2.4.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul O’Shannessy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-11-14 00:00:00.000000000 Z
13
+ date: 2017-11-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: appraisal