From: Akihiko Odaki Date: Sun, 4 Mar 2018 07:55:15 +0000 (+0900) Subject: Finalize location on scrollable notifications when unmounting (#6614) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=45feb439bd22c0999b8531879461e8d18fabe8a5;p=mastodon.git 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. --- 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());