From 8ac26dd19fd5576fa28c99bd5d71467dbd365956 Mon Sep 17 00:00:00 2001
From: Richard van der Hoff <richard@matrix.org>
Date: Tue, 11 Jul 2017 14:08:16 +0100
Subject: [PATCH 1/2] Give HomePage an unmounted guard

Also add missing return in error-handling path
---
 src/components/structures/HomePage.js | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/components/structures/HomePage.js b/src/components/structures/HomePage.js
index 2311cc1f..292fc77a 100644
--- a/src/components/structures/HomePage.js
+++ b/src/components/structures/HomePage.js
@@ -52,6 +52,8 @@ module.exports = React.createClass({
     },
 
     componentWillMount: function() {
+        this._unmounted = false;
+
         if (this.props.teamToken && this.props.teamServerUrl) {
             this.setState({
                 iframeSrc: `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`
@@ -67,9 +69,14 @@ module.exports = React.createClass({
             request(
                 { method: "GET", url: src },
                 (err, response, body) => {
+                    if (this.unmounted) {
+                        return;
+                    }
+
                     if (err || response.status < 200 || response.status >= 300) {
                         console.log(err);
                         this.setState({ page: "Couldn't load home page" });
+                        return;
                     }
 
                     body = body.replace(/_t\(['"]([\s\S]*?)['"]\)/mg, (match, g1)=>this.translate(g1));
@@ -79,6 +86,10 @@ module.exports = React.createClass({
         }
     },
 
+    componentWillUnmount: function() {
+        this._unmounted = true;
+    },
+
     render: function() {
         if (this.state.iframeSrc) {
             return (

From d755903fdbbed4a2809eccb48633569ac0825743 Mon Sep 17 00:00:00 2001
From: Richard van der Hoff <github@rvanderhoff.org.uk>
Date: Tue, 11 Jul 2017 14:10:18 +0100
Subject: [PATCH 2/2] typo

---
 src/components/structures/HomePage.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/structures/HomePage.js b/src/components/structures/HomePage.js
index 292fc77a..df8cc33e 100644
--- a/src/components/structures/HomePage.js
+++ b/src/components/structures/HomePage.js
@@ -69,7 +69,7 @@ module.exports = React.createClass({
             request(
                 { method: "GET", url: src },
                 (err, response, body) => {
-                    if (this.unmounted) {
+                    if (this._unmounted) {
                         return;
                     }