From 160c6fd40758657fc46f9a6bc3fa1b6d2aebd530 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Wed, 4 Jan 2017 11:51:58 -0500 Subject: [PATCH 1/2] DiscoverPage: pass query into handleSearchChanged() on mount --- js/page/discover.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/page/discover.js b/js/page/discover.js index acd126925..af9792236 100644 --- a/js/page/discover.js +++ b/js/page/discover.js @@ -292,7 +292,7 @@ var DiscoverPage = React.createClass({ document.title = "Discover"; if (this.props.query) { // Rendering with a query already typed - this.handleSearchChanged(); + this.handleSearchChanged(this.props.query); } }, From c3e08809c2738bbfa640b891a63d0469aa2cf9ae Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Wed, 4 Jan 2017 15:46:20 -0500 Subject: [PATCH 2/2] 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 },