From 45dcd5a1abaf0c792dac2084d53a69eefdf85914 Mon Sep 17 00:00:00 2001
From: mgabdev <>
Date: Thu, 11 Jul 2019 17:31:04 -0400
Subject: [PATCH] Updated timeline/notification dequeue to be in
 componentDidMount

---
 app/javascript/gabsocial/components/status_list.js       | 3 ++-
 app/javascript/gabsocial/features/notifications/index.js | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/app/javascript/gabsocial/components/status_list.js b/app/javascript/gabsocial/components/status_list.js
index 262f9635..91bbc511 100644
--- a/app/javascript/gabsocial/components/status_list.js
+++ b/app/javascript/gabsocial/components/status_list.js
@@ -27,7 +27,7 @@ export default class StatusList extends ImmutablePureComponent {
     onDequeueTimeline: PropTypes.func,
   };
 
-  componentWillUnmount() {
+  componentDidMount() {
     this.handleDequeueTimeline();
   };
 
@@ -73,6 +73,7 @@ export default class StatusList extends ImmutablePureComponent {
 
   handleDequeueTimeline = () => {
     const { onDequeueTimeline, timelineId } = this.props;
+    if (!onDequeueTimeline || !timelineId) return;
     onDequeueTimeline(timelineId);
   }
 
diff --git a/app/javascript/gabsocial/features/notifications/index.js b/app/javascript/gabsocial/features/notifications/index.js
index 9f4a7c35..0f932627 100644
--- a/app/javascript/gabsocial/features/notifications/index.js
+++ b/app/javascript/gabsocial/features/notifications/index.js
@@ -69,10 +69,10 @@ class Notifications extends React.PureComponent {
     this.handleScrollToTop.cancel();
     this.handleScroll.cancel();
     this.props.dispatch(scrollTopNotifications(false));
-    this.handleDequeueNotifications();
   }
 
   componentDidMount() {
+    this.handleDequeueNotifications();
     this.props.dispatch(scrollTopNotifications(true));
   }