isomorfeus-react 16.11.4 → 16.12.0

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
  SHA256:
3
- metadata.gz: 6a78c8d9211bde01b7c66f0b94a4d9a9e90d63301dcbd29352ba8b74936bd9d7
4
- data.tar.gz: 64b6b53a0e62071309732ad1b6d84451000ce172bc76685cf11f5b2edba3ff62
3
+ metadata.gz: 58043bfa06f9868b4f38d21df8e8fcc24e65c976c5b1ccb73394654bdb2eee5d
4
+ data.tar.gz: 9963861ee02870d4cd95400f15630584891b0f50dbd0757723ede1aeb97b577f
5
5
  SHA512:
6
- metadata.gz: ac38844e21385aa42c564373295d717fcba282a92ff82662740c294e5b9f45aecc69da75640d0c6bde20ebb652a4e9540eea47f47767c70974aec1a78b6044ba
7
- data.tar.gz: b724fe03121af4afd650be9fdde9e1140c89490c9beb451d2ac6ef0b76249c59220801b85f98ee054b46386fad478ac6bdd3db9e9fb752b31e7e2904bc1889ac
6
+ metadata.gz: 03df39b6b2ca9e8f0f8d288e8fa88caf93fd2fb01559d7d5d034939d9c3ceaf43d752db7497e30e609f8200207066bf27d9ba8534037345b0eb47d1d14f9a649
7
+ data.tar.gz: e9a70c65e05158fd364137cafb64f7ed18620203a807cb47bb189a2b2f1d212a39f51aeddf85eeaf1c37b8db62550d0b338a82a97e493f6e4045042a0a3220e5
@@ -10,7 +10,8 @@ module Isomorfeus
10
10
  component = nil
11
11
  begin
12
12
  component = component_name.constantize
13
- rescue Exception
13
+ rescue Exception => e
14
+ `console.warn("Deferring mount: " + #{e.message})`
14
15
  @timeout_start = Time.now unless @timeout_start
15
16
  if (Time.now - @timeout_start) < 10
16
17
  `setTimeout(Opal.Isomorfeus.TopLevel['$mount!'], 100)`
@@ -21,14 +22,17 @@ module Isomorfeus
21
22
  if component
22
23
  props_json = root_element.JS.getAttribute('data-iso-props')
23
24
  props = `Opal.Hash.$new(JSON.parse(props_json))`
24
- hydrated = root_element.JS.getAttribute('data-iso-hydrated')
25
+ raw_hydrated = root_element.JS.getAttribute('data-iso-hydrated')
26
+ hydrated = (raw_hydrated && raw_hydrated == "true")
25
27
  state_json = root_element.JS.getAttribute('data-iso-state')
26
28
  if state_json
27
29
  %x{
28
30
  var state = JSON.parse(state_json);
29
31
  var keys = Object.keys(state);
30
32
  for(var i=0; i < keys.length; i++) {
31
- global.Opal.Isomorfeus.store.native.dispatch({ type: keys[i].toUpperCase(), set_state: state[keys[i]] });
33
+ if (Object.keys(state[keys[i]]).length > 0) {
34
+ global.Opal.Isomorfeus.store.native.dispatch({ type: keys[i].toUpperCase(), set_state: state[keys[i]] });
35
+ }
32
36
  }
33
37
  }
34
38
  end
@@ -48,14 +52,24 @@ module Isomorfeus
48
52
  end
49
53
 
50
54
  def on_ready(&block)
51
- # this looks a bit odd but works across _all_ browsers, and no event handler mess
52
55
  %x{
53
56
  function run() { block.$call() };
54
- function ready_fun() {
55
- /in/.test(document.readyState) ? setTimeout(ready_fun,5) : run();
57
+ function ready_fun(fn) {
58
+ if (document.readyState === "complete" || document.readyState === "interactive") {
59
+ setTimeout(fn, 1);
60
+ } else {
61
+ document.addEventListener("DOMContentLoaded", fn);
62
+ }
56
63
  }
57
- ready_fun();
64
+ ready_fun(run);
58
65
  }
66
+ # %x{
67
+ # function run() { block.$call() };
68
+ # function ready_fun() {
69
+ # /in/.test(document.readyState) ? setTimeout(ready_fun,5) : run();
70
+ # }
71
+ # ready_fun();
72
+ # }
59
73
  end
60
74
 
61
75
  def on_ready_mount(component, props = nil, element_query = nil)
data/lib/react/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module React
2
- VERSION = '16.11.4'
2
+ VERSION = '16.12.0'
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.11.4
4
+ version: 16.12.0
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-11-06 00:00:00.000000000 Z
11
+ date: 2019-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -282,7 +282,7 @@ licenses:
282
282
  metadata: {}
283
283
  post_install_message: |2+
284
284
 
285
- isomorfeus-react 16.11.4:
285
+ isomorfeus-react 16.12.0:
286
286
  Major improvement:
287
287
  Using Zeitwerk and Opal-Zeitwerk for autoloading, may break existing installations which use opal-autoloader.
288
288
  - existing installations may lock isomorfeus-react to 16.11.1 or upgrade to isomorfeus 1.0.0.zeta6