react-rails 1.7.1 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5358f645472195824651e29b1eb26aae167b884c
4
- data.tar.gz: 74532c0b91eeb76798f034b16dcb504028e6ede5
3
+ metadata.gz: 317dcc49fd51fff94c69147c9cb9a66863af8cc1
4
+ data.tar.gz: 747c8e7a64afc813f317ee0e87c687b510027ace
5
5
  SHA512:
6
- metadata.gz: 0630dcf4a516bde9903eec349494b67f0a893736001509fca142d1e818d17ef6605fa26cfe6e353247579ddc1130f4d74e1cac7553b2a36bdd81121a395c51f9
7
- data.tar.gz: 250f92ee5338512c0b16605659776917f4aeeeff084487fa174f228494f442264dcb1dd64accab8e36c71ce4cc89af21364aceb579ff9b695c0d23cb40bb5b12
6
+ metadata.gz: dece437df496cb2260286e513821886ea394a1f445b26b2d435b4b87444365ba14055ce2748aa282343992b80751b6a0178e062ab4b9a6ccb94db1cdba314d46
7
+ data.tar.gz: 59c476692c2cc549607a01bd662c57f5c0c1786af55ebcc8a75696ecf6a816aec001508cda55ab4ec309d884e2c2e2c98f71ddee9fa2544b87a71e72fe7be2a2
@@ -8,6 +8,17 @@
8
8
 
9
9
  #### Bug Fixes
10
10
 
11
+ ## 1.7.2 (Jun3 19, 2016)
12
+
13
+ #### New Features
14
+
15
+ - Improved error messages for missing components #538
16
+
17
+ #### Bug Fixes
18
+
19
+ - Fix `view_helper_implementation` config #551
20
+ - Fallback to `EnvironmentContainer` for server rendering when manifest isn't available #545
21
+
11
22
  ## 1.7.1 (May 10, 2016)
12
23
 
13
24
  #### New Features
@@ -57,7 +57,14 @@
57
57
  var propsJson = node.getAttribute(window.ReactRailsUJS.PROPS_ATTR);
58
58
  var props = propsJson && JSON.parse(propsJson);
59
59
 
60
- ReactDOM.render(React.createElement(constructor, props), node);
60
+ if (typeof(constructor) === "undefined") {
61
+ var message = "Cannot find component: '" + className + "'"
62
+ if (console && console.log) { console.log("%c[react-rails] %c" + message + " for element", "font-weight: bold", "", node) }
63
+ var error = new Error(message + ". Make sure your component is globally available to render.")
64
+ throw error
65
+ } else {
66
+ ReactDOM.render(React.createElement(constructor, props), node);
67
+ }
61
68
  }
62
69
  },
63
70
 
@@ -25,7 +25,7 @@ module React
25
25
  end
26
26
 
27
27
  # Include the react-rails view helper lazily
28
- initializer "react_rails.setup_view_helpers", group: :all do |app|
28
+ initializer "react_rails.setup_view_helpers", after: :load_config_initializers, group: :all do |app|
29
29
 
30
30
  app.config.react.jsx_transformer_class ||= React::JSX::DEFAULT_TRANSFORMER
31
31
  React::JSX.transformer_class = app.config.react.jsx_transformer_class
@@ -53,7 +53,7 @@ module React
53
53
  end
54
54
  end
55
55
 
56
- initializer "react_rails.bust_cache", group: :all do |app|
56
+ initializer "react_rails.bust_cache", after: :load_config_initializers, group: :all do |app|
57
57
  asset_variant = React::Rails::AssetVariant.new({
58
58
  variant: app.config.react.variant,
59
59
  addons: app.config.react.addons,
@@ -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 the version hint in README.md, if needed
5
- VERSION = '1.7.1'
5
+ VERSION = '1.7.2'
6
6
  end
7
7
  end
@@ -14,6 +14,11 @@ module React
14
14
  asset_full_path = ::Rails.root.join("public", @manifest.dir, asset_path)
15
15
  File.read(asset_full_path)
16
16
  end
17
+
18
+ # sprockets-rails < 2.2.2 does not have `application.assets_manifest`
19
+ def self.compatible?
20
+ ::Rails.application.respond_to?(:assets_manifest)
21
+ end
17
22
  end
18
23
  end
19
24
  end
@@ -61,16 +61,18 @@ module React
61
61
  def asset_container
62
62
  @asset_container ||= if self.class.asset_container_class.present?
63
63
  self.class.asset_container_class.new
64
- elsif ::Rails.application.config.assets.compile
65
- EnvironmentContainer.new
64
+ elsif assets_precompiled? && ManifestContainer.compatible?
65
+ ManifestContainer.new
66
+ elsif assets_precompiled? && YamlManifestContainer.compatible?
67
+ YamlManifestContainer.new
66
68
  else
67
- if ::Rails::VERSION::MAJOR == 3
68
- YamlManifestContainer.new
69
- else
70
- ManifestContainer.new
71
- end
69
+ EnvironmentContainer.new
72
70
  end
73
71
  end
72
+
73
+ def assets_precompiled?
74
+ !::Rails.application.config.assets.compile
75
+ end
74
76
  end
75
77
  end
76
78
  end
@@ -14,6 +14,10 @@ module React
14
14
  asset_full_path = ::Rails.root.join("public", "assets", asset_path)
15
15
  File.read(asset_full_path)
16
16
  end
17
+
18
+ def self.compatible?
19
+ ::Rails::VERSION::MAJOR == 3
20
+ end
17
21
  end
18
22
  end
19
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul O’Shannessy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-10 00:00:00.000000000 Z
11
+ date: 2016-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal