react_on_rails 0.1.5 → 0.1.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b19c93747fab84bdc395c8f9dc2d664581863fca
|
4
|
+
data.tar.gz: 57488190d54beecdbc25296efd1d4ad0bc769cae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 480d293755f22424befb537760ccce6e3e148ce82adf015efa5a2fa3699486d615c7ab332e3b980bb22f423355c15027d706b6423824d24f3755e56bf605cf59
|
7
|
+
data.tar.gz: 5eeecc42bbe0e439ad468b42b683632101608fa4b0fbba72e4c01fd6619c673ac3f18716d6aa39df121021a4fee4555ea2b4e1e5916c3433830848d11ac5582c
|
@@ -78,7 +78,7 @@ module ReactOnRailsHelper
|
|
78
78
|
content_tag_options[:id] = dom_id
|
79
79
|
|
80
80
|
rendered_output = content_tag(:div,
|
81
|
-
server_rendered_html,
|
81
|
+
server_rendered_html.html_safe,
|
82
82
|
content_tag_options)
|
83
83
|
|
84
84
|
# IMPORTANT: Ensure that we mark string as html_safe to avoid escaping.
|
@@ -95,6 +95,7 @@ module ReactOnRailsHelper
|
|
95
95
|
end
|
96
96
|
|
97
97
|
# Returns Array [0]: html, [1]: script to console log
|
98
|
+
# NOTE, these are NOT html_safe!
|
98
99
|
def server_rendered_react_component_html(options, props_string, react_component_name, data_variable, dom_id)
|
99
100
|
if prerender(options)
|
100
101
|
render_js_expression = <<-JS
|
@@ -57,7 +57,7 @@ var console = { history: [] };
|
|
57
57
|
var htmlResult = '';
|
58
58
|
var consoleReplay = '';
|
59
59
|
#{ReactOnRails::ReactRenderer.wrap_code_with_exception_handler(result_js_code, component_name)}
|
60
|
-
#{console_replay_js_code}
|
60
|
+
#{console_replay_js_code}
|
61
61
|
return JSON.stringify([htmlResult, consoleReplay]);
|
62
62
|
})()
|
63
63
|
JS
|
@@ -82,10 +82,12 @@ var console = { history: [] };
|
|
82
82
|
console_script_lines = console_script.split("\n")
|
83
83
|
console_script_lines = console_script_lines[2..-2]
|
84
84
|
re = /console\.log\.apply\(console, \["\[SERVER\] (?<msg>.*)"\]\);/
|
85
|
-
console_script_lines
|
86
|
-
|
87
|
-
|
88
|
-
|
85
|
+
if console_script_lines
|
86
|
+
console_script_lines.each do |line|
|
87
|
+
match = re.match(line)
|
88
|
+
if match
|
89
|
+
Rails.logger.info { "[react_on_rails] #{match[:msg]}" }
|
90
|
+
end
|
89
91
|
end
|
90
92
|
end
|
91
93
|
end
|
@@ -153,7 +155,7 @@ var console = { history: [] };
|
|
153
155
|
def base_js_code(bundle_js_code)
|
154
156
|
<<-JS
|
155
157
|
#{CONSOLE_POLYFILL}
|
156
|
-
#{bundle_js_code};
|
158
|
+
#{bundle_js_code};
|
157
159
|
JS
|
158
160
|
end
|
159
161
|
|