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 +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/assets/javascripts/react_ujs_mount.js +8 -1
- data/lib/react/rails/railtie.rb +2 -2
- data/lib/react/rails/version.rb +1 -1
- data/lib/react/server_rendering/manifest_container.rb +5 -0
- data/lib/react/server_rendering/sprockets_renderer.rb +9 -7
- data/lib/react/server_rendering/yaml_manifest_container.rb +4 -0
- 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: 317dcc49fd51fff94c69147c9cb9a66863af8cc1
|
4
|
+
data.tar.gz: 747c8e7a64afc813f317ee0e87c687b510027ace
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dece437df496cb2260286e513821886ea394a1f445b26b2d435b4b87444365ba14055ce2748aa282343992b80751b6a0178e062ab4b9a6ccb94db1cdba314d46
|
7
|
+
data.tar.gz: 59c476692c2cc549607a01bd662c57f5c0c1786af55ebcc8a75696ecf6a816aec001508cda55ab4ec309d884e2c2e2c98f71ddee9fa2544b87a71e72fe7be2a2
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
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
|
|
data/lib/react/rails/railtie.rb
CHANGED
@@ -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,
|
data/lib/react/rails/version.rb
CHANGED
@@ -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
|
65
|
-
|
64
|
+
elsif assets_precompiled? && ManifestContainer.compatible?
|
65
|
+
ManifestContainer.new
|
66
|
+
elsif assets_precompiled? && YamlManifestContainer.compatible?
|
67
|
+
YamlManifestContainer.new
|
66
68
|
else
|
67
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2016-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|