lib/react/component/callbacks.rb in isomorfeus-react-16.12.1 vs lib/react/component/callbacks.rb in isomorfeus-react-16.12.2

- old
+ new

@@ -5,11 +5,11 @@ base.instance_exec do def component_did_catch(&block) # TODO convert error and info %x{ var fun = function(error, info) { - Opal.React.active_redux_components.push(this.__ruby_instance); + Opal.React.active_redux_components.push(this); #{`this.__ruby_instance`.instance_exec(`error`, `info`, &block)}; Opal.React.active_redux_components.pop(); } if (self.lucid_react_component) { self.lucid_react_component.prototype.componentDidCatch = fun; } else { self.react_component.prototype.componentDidCatch = fun; } @@ -17,11 +17,11 @@ end def component_did_mount(&block) %x{ let fun = function() { - Opal.React.active_redux_components.push(this.__ruby_instance); + Opal.React.active_redux_components.push(this); #{`this.__ruby_instance`.instance_exec(&block)}; Opal.React.active_redux_components.pop(); } if (self.lucid_react_component) { if (self.lucid_react_component.prototype.componentDidMount) { @@ -38,11 +38,11 @@ end def component_did_update(&block) %x{ var fun = function(prev_props, prev_state, snapshot) { - Opal.React.active_redux_components.push(this.__ruby_instance); + Opal.React.active_redux_components.push(this); #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: prev_props})`, `Opal.React.Component.State.$new({state: prev_state})`, `snapshot`, &block)}; Opal.React.active_redux_components.pop(); } @@ -53,11 +53,11 @@ def component_will_unmount(&block) %x{ var fun = function() { if (typeof this.unsubscriber === "function") { this.unsubscriber(); }; - Opal.React.active_redux_components.push(this.__ruby_instance); + Opal.React.active_redux_components.push(this); #{`this.__ruby_instance`.instance_exec(&block)}; Opal.React.active_redux_components.pop(); } if (self.lucid_react_component) { self.lucid_react_component.prototype.componentWillUnmount = fun; } else { self.react_component.prototype.componentWillUnmount = fun; } @@ -79,11 +79,11 @@ end def get_derived_state_from_props(&block) %x{ var fun = function(props, state) { - Opal.React.active_redux_components.push(this.__ruby_instance); + Opal.React.active_redux_components.push(this); var result = #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: props})`, `Opal.React.Component.State.$new({state: state})`, &block)}; Opal.React.active_redux_components.pop(); if (typeof result.$to_n === 'function') { result = result.$to_n() } if (result === Opal.nil) { return null; } @@ -95,10 +95,10 @@ end def get_snapshot_before_update(&block) %x{ var fun = function(prev_props, prev_state) { - + Opal.React.active_redux_components.push(this); var result = #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: prev_props})`, `Opal.React.Component.State.$new({state: prev_state})`, &block)}; Opal.React.active_redux_components.pop(); if (result === Opal.nil) { return null; } return result;