Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
guard setState so that it is not called when the container is already…
Browse files Browse the repository at this point in the history
… unmounted
  • Loading branch information
leonid-shevtsov committed Aug 2, 2015
1 parent 3effae4 commit eba9e48
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/createContainer.js
Expand Up @@ -104,7 +104,9 @@ module.exports = function (Component, options) {

promise.then(function (queryResults) {
try {
_this.setState(queryResults);
// See discussion at https://github.com/facebook/react/issues/2787
if (_this.isMounted())
_this.setState(queryResults);
}
catch (error) {
// Call to setState may fail if renderToString() was used.
Expand Down

0 comments on commit eba9e48

Please sign in to comment.