From 05a36331f4ffb1efc567a16cad1e47cff66f7b8e Mon Sep 17 00:00:00 2001 From: Benjamin Faal Date: Tue, 29 Aug 2017 20:42:34 +0200 Subject: [PATCH 1/2] Fix crash when componentWillUnmount is called Sometimes the subscription can be undefined, so now it checks for undefined or not and then disposes the subscription --- src/ParseComponent.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ParseComponent.js b/src/ParseComponent.js index 9dadc60..4b10aa1 100644 --- a/src/ParseComponent.js +++ b/src/ParseComponent.js @@ -148,8 +148,10 @@ export default function(React) { _unsubscribe() { for (var name in this._subscriptions) { - this._subscriptions[name].dispose(); - } + if (this._subscriptions[name]) { + this._subscriptions[name].dispose(); + } + } this._subscriptions = {}; } @@ -165,4 +167,4 @@ export default function(React) { this.forceUpdate(); } } -}; \ No newline at end of file +}; From 9c7419d017cdec932743b35a88a64792aa00886f Mon Sep 17 00:00:00 2001 From: Benjamin Faal Date: Tue, 29 Aug 2017 20:52:36 +0200 Subject: [PATCH 2/2] Update ParseComponent.js --- src/ParseComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ParseComponent.js b/src/ParseComponent.js index 4b10aa1..4bec888 100644 --- a/src/ParseComponent.js +++ b/src/ParseComponent.js @@ -148,7 +148,7 @@ export default function(React) { _unsubscribe() { for (var name in this._subscriptions) { - if (this._subscriptions[name]) { + if (this._subscriptions[name] && this._subscriptions[name].dispose) { this._subscriptions[name].dispose(); } }