From bec845b7f718f29eef8bf7a2cf01c1ff9f28e17e Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Sun, 4 Mar 2018 16:55:15 +0900 Subject: [PATCH] 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. --- app/javascript/mastodon/features/notifications/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/javascript/mastodon/features/notifications/index.js b/app/javascript/mastodon/features/notifications/index.js index 35b430bfb5..77abfae25a 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());