about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>2018-03-04 16:55:15 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-03-04 08:55:15 +0100
commit45feb439bd22c0999b8531879461e8d18fabe8a5 (patch)
tree97c9aebc9377d8f3ff9ffb784e64dbee8c49d257 /app/javascript
parent44829d8216001e3d8183dbd12cacc5a2f4826751 (diff)
Finalize location on scrollable notifications when unmounting (#6614)
The top of the scrollable notifications will be invisible after unmounting.
The Redux state should be updated accordingly in such a case so that the
unread notification counter will be updated later.
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/features/notifications/index.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/javascript/mastodon/features/notifications/index.js b/app/javascript/mastodon/features/notifications/index.js
index 35b430bfb..77abfae25 100644
--- a/app/javascript/mastodon/features/notifications/index.js
+++ b/app/javascript/mastodon/features/notifications/index.js
@@ -50,6 +50,13 @@ export default class Notifications extends React.PureComponent {
     trackScroll: true,
   };
 
+  componentWillUnmount () {
+    this.handleScrollToBottom.cancel();
+    this.handleScrollToTop.cancel();
+    this.handleScroll.cancel();
+    this.props.dispatch(scrollTopNotifications(false));
+  }
+
   handleScrollToBottom = debounce(() => {
     this.props.dispatch(scrollTopNotifications(false));
     this.props.dispatch(expandNotifications());