isomorfeus-react 16.12.21 → 16.12.22
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/lib/isomorfeus/react_view_helper.rb +13 -7
- data/lib/react/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d65c796b51f3f092183c852451e9b6f6f5ccaf317ebf8b86bae0e9e5b5cf153c
|
|
4
|
+
data.tar.gz: b5c052732a73c91f17b40822a92739508bfb0eae3214015e801d535385f67820
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d96621250130c607b767a62b5110dd7d9ff77a26a7d21f7c3ca848e304af9dca76a093620b17bfb585fd7696ab5faeccd27ff677fe04cff06f67c7ea64203af
|
|
7
|
+
data.tar.gz: d79bc09fa47a16b566877ca6e4621c6ae4516d5c473eca02f11d0a73c953b3cad9c7e6b3b4e8e116a325c4bfee34bb8fd55c9d43898a763d92f48f439725b12d
|
|
@@ -24,7 +24,11 @@ module Isomorfeus
|
|
|
24
24
|
@ssr_response_status = nil
|
|
25
25
|
@ssr_styles = nil
|
|
26
26
|
thread_id_asset = "#{Thread.current.object_id}#{asset}"
|
|
27
|
-
render_result =
|
|
27
|
+
render_result = if static
|
|
28
|
+
'<div>'
|
|
29
|
+
else
|
|
30
|
+
"<div data-iso-env=\"#{Isomorfeus.env}\" data-iso-root=\"#{component_name}\" data-iso-props='#{Oj.dump(props, mode: :strict)}'"
|
|
31
|
+
end
|
|
28
32
|
if Isomorfeus.server_side_rendering
|
|
29
33
|
|
|
30
34
|
if Isomorfeus.development?
|
|
@@ -188,17 +192,19 @@ module Isomorfeus
|
|
|
188
192
|
Isomorfeus.raise_error(message: exception['message'], stack: exception['stack']) if exception
|
|
189
193
|
|
|
190
194
|
# build result
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
195
|
+
unless static
|
|
196
|
+
render_result << " data-iso-hydrated='true'" if rendered_tree
|
|
197
|
+
if Isomorfeus.respond_to?(:current_user) && Isomorfeus.current_user && !Isomorfeus.current_user.anonymous?
|
|
198
|
+
render_result << " data-iso-usid=#{Oj.dump(Isomorfeus.current_user.to_sid, mode: :strict)}"
|
|
199
|
+
end
|
|
200
|
+
render_result << " data-iso-nloc='#{props[:locale]}'>"
|
|
194
201
|
end
|
|
195
|
-
render_result << " data-iso-nloc='#{props[:locale]}'>"
|
|
196
202
|
render_result << (rendered_tree ? rendered_tree : "SSR didn't work")
|
|
197
203
|
else
|
|
198
|
-
render_result << " data-iso-nloc='#{props[:locale]}'>"
|
|
204
|
+
render_result << " data-iso-nloc='#{props[:locale]}'>" unless static
|
|
199
205
|
end
|
|
200
206
|
render_result << '</div>'
|
|
201
|
-
if Isomorfeus.server_side_rendering
|
|
207
|
+
if Isomorfeus.server_side_rendering && !static
|
|
202
208
|
render_result = "<script type='application/javascript'>\nServerSideRenderingStateJSON = #{Oj.dump(application_state, mode: :strict)}\n</script>\n" << render_result
|
|
203
209
|
end
|
|
204
210
|
render_result
|
data/lib/react/version.rb
CHANGED