isomorfeus-react 16.10.13 → 16.10.14

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
  SHA256:
3
- metadata.gz: 89d11f7a3996ea44b089e50e65bd9e473edeb12cb877599054790db2705caa8a
4
- data.tar.gz: 90ce6397b467688228cce66dcc0f3b1cd59a0aa15c83dd8ce3f15a3997017750
3
+ metadata.gz: d117c74e849bc16c8e1bd1d1fec0984cbd11b997da4cde97ce47b5fbe68a49b1
4
+ data.tar.gz: 9bfd39d25d93d9549e6fec23a5f8026ff95891b39fd5939cf32100201d089582
5
5
  SHA512:
6
- metadata.gz: e3bf6b9a9029f53ad7ccdbc674bc166e09b863d7ab088cfcd68c732e1592d2986b514faf6c33e0aa13fa9f12b820f87c11570f46a55fe10130cc87757c423bef
7
- data.tar.gz: 84450d0bff23041bcadb040107e72f8086c9631f7849a1b889a9a8e903274acb008f185a1dacb1aef7fe5dafef39863293cbad9c89e5dae9545839b7be39cbe0
6
+ metadata.gz: 1aa9a952a7fccc0a35b4a82c1f7edc0359419a6257a2ccf6c6846690b421d925274b9eeca3d2871755eaf2245949b70772350a7c811b2618ec0c562eae59d995
7
+ data.tar.gz: b78c932a297a7c6768ed63d9664ab8ea224b35111eb24f552df49e6d2fc573f58a2779e2019cfa3d32c903e37b66b7f73787ae88a474186e8c77a2216deb64e6
@@ -16,8 +16,12 @@ module Isomorfeus
16
16
  runtime.vm.delete_context(uuid)
17
17
  end
18
18
  asset_path = "#{OpalWebpackLoader.client_asset_path}#{asset}"
19
- asset = Net::HTTP.get(URI(asset_path))
20
- Isomorfeus.ssr_contexts[thread_id_asset] = ExecJS.permissive_compile(asset)
19
+ begin
20
+ asset = Net::HTTP.get(URI(asset_path))
21
+ Isomorfeus.ssr_contexts[thread_id_asset] = ExecJS.permissive_compile(asset)
22
+ rescue
23
+ STDERR.puts "SSR: Failed loading assets from webpack dev server."
24
+ end
21
25
  else
22
26
  # initialize speednode context
23
27
  unless Isomorfeus.ssr_contexts.key?(thread_id_asset)
@@ -143,6 +147,7 @@ module Isomorfeus
143
147
  rendered_tree, application_state, @ssr_styles, @ssr_response_status = Isomorfeus.ssr_contexts[thread_id_asset].exec(javascript)
144
148
 
145
149
  # build result
150
+ render_result << " data-iso-hydrated='true'" if rendered_tree
146
151
  render_result << " data-iso-nloc='#{props[:locale]}' data-iso-state='#{Oj.dump(application_state, mode: :strict)}'>"
147
152
  render_result << (rendered_tree ? rendered_tree : "SSR didn't work")
148
153
  else
@@ -5,7 +5,6 @@ module LucidApp
5
5
  base.extend(::LucidApp::NativeComponentConstructor)
6
6
  base.extend(::LucidPropDeclaration::Mixin)
7
7
  base.extend(::React::Component::EventHandler)
8
- base.include(::LucidComponent::PreloadingSupport)
9
8
  base.extend(::LucidComponent::EnvironmentSupport)
10
9
  base.include(::LucidComponent::EnvironmentSupport)
11
10
  base.include(::React::Component::Elements)
@@ -70,8 +70,7 @@ module LucidApp
70
70
  Opal.React.active_redux_components.pop();
71
71
  Opal.React.active_components.pop();
72
72
  // console.log("lucid app popping", Opal.React.render_buffer, Opal.React.render_buffer.toString());
73
- let children = Opal.React.render_buffer.pop();
74
- return Opal.global.React.createElement(Opal.global.LucidApplicationContext.Provider, { value: this.state.isomorfeus_store_state }, children);
73
+ return Opal.global.React.createElement(Opal.global.LucidApplicationContext.Provider, { value: this.state.isomorfeus_store_state }, Opal.React.render_buffer.pop());
75
74
  }
76
75
  data_access() {
77
76
  return this.context;
@@ -57,6 +57,10 @@ module LucidComponent
57
57
  Opal.React.active_redux_components.pop();
58
58
  Opal.React.active_components.pop();
59
59
  // console.log("lucid component popping", Opal.React.render_buffer, Opal.React.render_buffer.toString());
60
+ if (base.except_ssr) {
61
+ if (typeof block_result === "object" && block_result.danger) { return Opal.global.React.createElement('div', {'data-ssrhelper': this.__ruby_instance.$class().$to_s(), dangerouslySetInnerHTML: { __html: block_result.html}});}
62
+ else { return Opal.global.React.createElement('div', {'data-ssrhelper': this.__ruby_instance.$class().$to_s()}, Opal.React.render_buffer.pop()); }
63
+ }
60
64
  return Opal.React.render_buffer.pop();
61
65
  }
62
66
  data_access() {
@@ -11,7 +11,24 @@ module LucidComponent
11
11
  end
12
12
  end
13
13
 
14
- def while_loading(&block)
14
+ def while_loading(option = nil, &block)
15
+ if option == :except_ssr
16
+ `base.except_ssr = true;`
17
+ block = if on_ssr?
18
+ proc { instance_exec(&`base.render_block`) }
19
+ else
20
+ given_block = block
21
+ proc do
22
+ %x{
23
+ let query = "[data-ssrhelper='" + #{self.class.to_s} + "']";
24
+ let el = document.querySelector(query);
25
+ if (el) { return { danger: true, html: el.innerHTML }; }
26
+ else { return #{instance_exec(&given_block)};
27
+ }
28
+ }
29
+ end
30
+ end
31
+ end
15
32
  `base.while_loading_block = block`
16
33
  end
17
34
  end
@@ -6,7 +6,6 @@ module LucidMaterial
6
6
  base.extend(::LucidMaterial::App::NativeComponentConstructor)
7
7
  base.extend(::LucidPropDeclaration::Mixin)
8
8
  base.extend(::React::Component::EventHandler)
9
- base.include(::LucidComponent::PreloadingSupport)
10
9
  base.extend(::LucidComponent::EnvironmentSupport)
11
10
  base.include(::LucidComponent::EnvironmentSupport)
12
11
  base.include(::React::Component::Elements)
@@ -71,8 +71,7 @@ module LucidMaterial
71
71
  Opal.React.active_redux_components.pop();
72
72
  Opal.React.active_components.pop();
73
73
  // console.log("material app popping", Opal.React.render_buffer, Opal.React.render_buffer.toString());
74
- var children = Opal.React.render_buffer.pop();
75
- return Opal.global.React.createElement(Opal.global.LucidApplicationContext.Provider, { value: this.state.isomorfeus_store_state }, children);
74
+ return Opal.global.React.createElement(Opal.global.LucidApplicationContext.Provider, { value: this.state.isomorfeus_store_state }, Opal.React.render_buffer.pop());
76
75
  }
77
76
  data_access() {
78
77
  return this.context;
@@ -58,6 +58,10 @@ module LucidMaterial
58
58
  Opal.React.active_redux_components.pop();
59
59
  Opal.React.active_components.pop();
60
60
  // console.log("material component popping", Opal.React.render_buffer, Opal.React.render_buffer.toString());
61
+ if (base.except_ssr) {
62
+ if (typeof block_result === "object" && block_result.danger) { return Opal.global.React.createElement('div', {'data-ssrhelper': this.__ruby_instance.$class().$to_s(), dangerouslySetInnerHTML: { __html: block_result.html}});}
63
+ else { return Opal.global.React.createElement('div', {'data-ssrhelper': this.__ruby_instance.$class().$to_s()}, Opal.React.render_buffer.pop()); }
64
+ }
61
65
  return Opal.React.render_buffer.pop();
62
66
  }
63
67
  data_access() {
@@ -1,3 +1,3 @@
1
1
  module React
2
- VERSION = '16.10.13'
2
+ VERSION = '16.10.14'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-react
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.10.13
4
+ version: 16.10.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-19 00:00:00.000000000 Z
11
+ date: 2019-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -241,14 +241,7 @@ homepage: http://isomorfeus.com
241
241
  licenses:
242
242
  - MIT
243
243
  metadata: {}
244
- post_install_message: |2+
245
-
246
- isomorfeus-react 16.10.12:
247
- Breaking changes:
248
- Server Side Rendering is on by default in the development environment.
249
- Please enable SSR asset builds in the webpack config of your app or turn SSR off with:
250
- Isomorfeus.server_side_rendering = false
251
-
244
+ post_install_message:
252
245
  rdoc_options: []
253
246
  require_paths:
254
247
  - lib