From c3e08809c2738bbfa640b891a63d0469aa2cf9ae Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Wed, 4 Jan 2017 15:46:20 -0500 Subject: [PATCH] Check if Thumbnail is still mounted before confirming its image loaded --- js/component/common.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/component/common.js b/js/component/common.js index c2a152984..465b2bd41 100644 --- a/js/component/common.js +++ b/js/component/common.js @@ -120,6 +120,7 @@ export let Address = React.createClass({ export let Thumbnail = React.createClass({ _defaultImageUri: '/img/default-thumb.svg', _maxLoadTime: 10000, + _isMounted: false, propTypes: { src: React.PropTypes.string.isRequired, @@ -137,14 +138,18 @@ export let Thumbnail = React.createClass({ }; }, componentDidMount: function() { + this._isMounted = true; setTimeout(() => { - if (!this.refs.img.complete) { + if (this._isMounted && !this.refs.img.complete) { this.setState({ imageUri: this._defaultImageUri, }); } }, this._maxLoadTime); }, + componentWillUnmount: function() { + this._isMounted = false; + }, render: function() { return },