isomorfeus-react 16.9.2 → 16.9.3

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: 36a1941b8bebb3eef585602735dc05d182dfe09b6ad1f5ba774ddb10790556bb
4
- data.tar.gz: 549f3f98cc52b1f47aed4b6e7b0152d924a0827c868165ee5ada3099b4e7037d
3
+ metadata.gz: 81bc6523000cdabde5e53469a494472e5fc2bbf8afdfdc4ba90b5d0483f5aae5
4
+ data.tar.gz: f8c768ab6fadb01f0199b0cec8db35356b30759897369ba8db0c340ad5f2b15a
5
5
  SHA512:
6
- metadata.gz: a13a3fbcb9b37b09104e8397cf9e13e4e70f0d8fcd3cbc3e879369fb213880d0d3505ede782263702ab0d543197663d6b9000ddd27334a726bdf1695d248fc94
7
- data.tar.gz: 06e9d53a8ac9d70125ac519835ad128ca3e47b54bef2eb4a5320116b92b294841403fe2c34f966321318c38588dfefea1822f3259f6294414304245459577faa
6
+ metadata.gz: 613e7d265c470bab6690c0808395f699438dfcba5b71a1a346ebbbf9a0f897c8678d2afdd05409493ba64aa920c8af7fc3ad1c7a173ac5f2627cd369fb3f6c02
7
+ data.tar.gz: dbd5819a705824b0701650c5ea7e9c61a176d03eae852eb698de96652b7e89681f8d6e4e54353ee69b2308f274b77acd970a159601d862727c9eb8dc22cca4f7
@@ -19,12 +19,13 @@ module Isomorfeus
19
19
 
20
20
  # if location_host and scheme are given and if Transport is loaded, connect and then render, otherwise do not render
21
21
  ws_scheme = props[:location_scheme] == 'https:' ? 'wss:' : 'ws:'
22
+ location_host = props[:location_host] ? props[:location_host] : 'localhost'
22
23
  api_ws_path = Isomorfeus.respond_to?(:api_websocket_path) ? Isomorfeus.api_websocket_path : ''
23
24
  javascript << <<~JAVASCRIPT
24
- var location_host = '#{props[:location_host]}';
25
+ var location_host = '#{location_host}';
25
26
  var ws_scheme = '#{ws_scheme}';
26
27
  var api_ws_path = '#{api_ws_path}';
27
- if (typeof global.Opal.Isomorfeus.Transport !== 'undefined' && location_host !== '' && api_ws_path !== '') {
28
+ if (typeof global.Opal.Isomorfeus.Transport !== 'undefined' && api_ws_path !== '') {
28
29
  global.Opal.Isomorfeus.TopLevel["$transport_ws_url="](ws_scheme + location_host + api_ws_path);
29
30
  global.Opal.send(global.Opal.Isomorfeus.Transport.$promise_connect(), 'then', [], ($$1 = function(){
30
31
  try {
@@ -60,8 +60,8 @@ module React
60
60
  %x{
61
61
  var fun = function(error) {
62
62
  var result = #{`this.__ruby_instance`.instance_exec(`error`, &block)};
63
- if (result === null) { return null; }
64
- if (typeof result.$to_n === 'function') { return result.$to_n() }
63
+ if (typeof result.$to_n === 'function') { result = result.$to_n() }
64
+ if (result === Opal.nil) { return null; }
65
65
  return result;
66
66
  }
67
67
  if (self.lucid_react_component) { self.lucid_react_component.prototype.getDerivedStateFromError = fun; }
@@ -73,10 +73,12 @@ module React
73
73
  %x{
74
74
  var fun = function(props, state) {
75
75
  Opal.React.active_redux_components.push(this.__ruby_instance);
76
- #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: props})`,
77
- `Opal.React.Component.State.$new({state: state})`,
78
- &block)};
76
+ var result = #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: props})`,
77
+ `Opal.React.Component.State.$new({state: state})`, &block)};
79
78
  Opal.React.active_redux_components.pop();
79
+ if (typeof result.$to_n === 'function') { result = result.$to_n() }
80
+ if (result === Opal.nil) { return null; }
81
+ return result;
80
82
  }
81
83
  if (self.lucid_react_component) { self.lucid_react_component.prototype.getDerivedStateFromProps = fun; }
82
84
  else { self.react_component.prototype.getDerivedStateFromProps = fun; }
@@ -86,11 +88,12 @@ module React
86
88
  def get_snapshot_before_update(&block)
87
89
  %x{
88
90
  var fun = function(prev_props, prev_state) {
89
- Opal.React.active_redux_components.push(this.__ruby_instance);
90
- #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: prev_props})`,
91
- `Opal.React.Component.State.$new({state: prev_state})`,
92
- &block)};
91
+
92
+ var result = #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: prev_props})`,
93
+ `Opal.React.Component.State.$new({state: prev_state})`, &block)};
93
94
  Opal.React.active_redux_components.pop();
95
+ if (result === Opal.nil) { return null; }
96
+ return result;
94
97
  }
95
98
  if (self.lucid_react_component) { self.lucid_react_component.prototype.getSnapshotBeforeUpdate = fun; }
96
99
  else { self.react_component.prototype.getSnapshotBeforeUpdate = fun; }
data/lib/react/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module React
2
- VERSION = '16.9.2'
2
+ VERSION = '16.9.3'
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.9.2
4
+ version: 16.9.3
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-08-12 00:00:00.000000000 Z
11
+ date: 2019-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -258,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
258
  - !ruby/object:Gem::Version
259
259
  version: '0'
260
260
  requirements: []
261
- rubygems_version: 3.0.3
261
+ rubygems_version: 3.0.6
262
262
  signing_key:
263
263
  specification_version: 4
264
264
  summary: React for Opal Ruby.