react-facebook
Advanced tools
Comparing version 5.0.2 to 5.0.3
@@ -26,3 +26,4 @@ 'use strict'; | ||
return _temp = _this = super(...args), this.state = { | ||
isWorking: false | ||
isWorking: false, | ||
isMounted: true | ||
}, this.handleClick = (() => { | ||
@@ -68,5 +69,8 @@ var _ref = (0, _asyncToGenerator3.default)(function* (evn) { | ||
_this.setState({ | ||
isWorking: false | ||
}); | ||
const { isMounted } = _this.state; | ||
if (isMounted) { | ||
_this.setState({ | ||
isWorking: false | ||
}); | ||
} | ||
}); | ||
@@ -78,7 +82,10 @@ | ||
})(), this.handleFacebookReady = facebook => { | ||
this.setState({ facebook }); | ||
const { isMounted } = this.state; | ||
if (isMounted) { | ||
this.setState({ facebook }); | ||
const { onReady } = this.props; | ||
if (onReady) { | ||
onReady(facebook); | ||
const { onReady } = this.props; | ||
if (onReady) { | ||
onReady(facebook); | ||
} | ||
} | ||
@@ -88,2 +95,8 @@ }, _temp; | ||
componentWillUnmount() { | ||
this.setState({ | ||
isMounted: false | ||
}); | ||
} | ||
getElement() { | ||
@@ -90,0 +103,0 @@ const { |
@@ -53,6 +53,7 @@ 'use strict'; | ||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { | ||
isWorking: false | ||
isWorking: false, | ||
isMounted: true | ||
}, _this.handleClick = function () { | ||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(evn) { | ||
var facebook, _this$props, _dontWait, _onResponse, _onError, response, _onError2; | ||
var facebook, _this$props, _dontWait, _onResponse, _onError, response, _onError2, isMounted; | ||
@@ -133,8 +134,11 @@ return _regenerator2.default.wrap(function _callee$(_context) { | ||
case 26: | ||
isMounted = _this.state.isMounted; | ||
_this.setState({ | ||
isWorking: false | ||
}); | ||
if (isMounted) { | ||
_this.setState({ | ||
isWorking: false | ||
}); | ||
} | ||
case 27: | ||
case 28: | ||
case 'end': | ||
@@ -151,8 +155,12 @@ return _context.stop(); | ||
}(), _this.handleFacebookReady = function (facebook) { | ||
_this.setState({ facebook: facebook }); | ||
var isMounted = _this.state.isMounted; | ||
var onReady = _this.props.onReady; | ||
if (isMounted) { | ||
_this.setState({ facebook: facebook }); | ||
if (onReady) { | ||
onReady(facebook); | ||
var _onReady = _this.props.onReady; | ||
if (_onReady) { | ||
_onReady(facebook); | ||
} | ||
} | ||
@@ -162,2 +170,8 @@ }, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret); | ||
Process.prototype.componentWillUnmount = function componentWillUnmount() { | ||
this.setState({ | ||
isMounted: false | ||
}); | ||
}; | ||
Process.prototype.getElement = function getElement() { | ||
@@ -164,0 +178,0 @@ var _props = this.props, |
@@ -12,3 +12,4 @@ import _asyncToGenerator from 'babel-runtime/helpers/asyncToGenerator'; | ||
return _temp = _this = super(...args), this.state = { | ||
isWorking: false | ||
isWorking: false, | ||
isMounted: true | ||
}, this.handleClick = (() => { | ||
@@ -54,5 +55,8 @@ var _ref = _asyncToGenerator(function* (evn) { | ||
_this.setState({ | ||
isWorking: false | ||
}); | ||
const { isMounted } = _this.state; | ||
if (isMounted) { | ||
_this.setState({ | ||
isWorking: false | ||
}); | ||
} | ||
}); | ||
@@ -64,7 +68,10 @@ | ||
})(), this.handleFacebookReady = facebook => { | ||
this.setState({ facebook }); | ||
const { isMounted } = this.state; | ||
if (isMounted) { | ||
this.setState({ facebook }); | ||
const { onReady } = this.props; | ||
if (onReady) { | ||
onReady(facebook); | ||
const { onReady } = this.props; | ||
if (onReady) { | ||
onReady(facebook); | ||
} | ||
} | ||
@@ -74,2 +81,8 @@ }, _temp; | ||
componentWillUnmount() { | ||
this.setState({ | ||
isMounted: false | ||
}); | ||
} | ||
getElement() { | ||
@@ -76,0 +89,0 @@ const { |
{ | ||
"name": "react-facebook", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"description": "Facebook components like a Login button, Like, Share, Comments, Embedded Post/Video, Messenger Chat and others", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -16,3 +16,7 @@ // @flow | ||
export default class Process extends Component<Props> { | ||
type State = { | ||
isMounted: boolean, | ||
}; | ||
export default class Process extends Component<Props, State> { | ||
static defaultProps = { | ||
@@ -28,6 +32,13 @@ children: undefined, | ||
state = { | ||
state: State = { | ||
isWorking: false, | ||
isMounted: true, | ||
}; | ||
componentWillUnmount() { | ||
this.setState({ | ||
isMounted: false, | ||
}); | ||
} | ||
getElement() { | ||
@@ -108,13 +119,19 @@ const { | ||
this.setState({ | ||
isWorking: false, | ||
}); | ||
const { isMounted } = this.state; | ||
if (isMounted) { | ||
this.setState({ | ||
isWorking: false, | ||
}); | ||
} | ||
} | ||
handleFacebookReady = (facebook) => { | ||
this.setState({ facebook }); | ||
const { isMounted } = this.state; | ||
if (isMounted) { | ||
this.setState({ facebook }); | ||
const { onReady } = this.props; | ||
if (onReady) { | ||
onReady(facebook); | ||
const { onReady } = this.props; | ||
if (onReady) { | ||
onReady(facebook); | ||
} | ||
} | ||
@@ -121,0 +138,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
465945
7414