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 }, 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); } },