From 362b9f2f940a242b19fe2d4d1b2e896ad12ab092 Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Tue, 1 Dec 2015 11:59:35 -0500
Subject: Fix channel creation errors

---
 web/react/components/channel_notifications_modal.jsx | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

(limited to 'web/react/components/channel_notifications_modal.jsx')

diff --git a/web/react/components/channel_notifications_modal.jsx b/web/react/components/channel_notifications_modal.jsx
index 79b769c8a..bae1f13f0 100644
--- a/web/react/components/channel_notifications_modal.jsx
+++ b/web/react/components/channel_notifications_modal.jsx
@@ -32,11 +32,13 @@ export default class ChannelNotificationsModal extends React.Component {
             activeSection: ''
         };
     }
-    componentDidMount() {
-        ChannelStore.addChangeListener(this.onListenerChange);
-    }
-    componentWillUnmount() {
-        ChannelStore.removeChangeListener(this.onListenerChange);
+    componentWillReceiveProps(nextProps) {
+        if (nextProps.show) {
+            this.onListenerChange();
+            ChannelStore.addChangeListener(this.onListenerChange);
+        } else {
+            ChannelStore.removeChangeListener(this.onListenerChange);
+        }
     }
     onListenerChange() {
         const curChannelId = ChannelStore.getCurrentId();
-- 
cgit v1.2.3-1-g7c22

