1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-28 06:48:28 +09:00

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.
This commit is contained in:
Akihiko Odaki 2018-03-04 16:55:15 +09:00 committed by Eugen Rochko
parent 44829d8216
commit 45feb439bd

View File

@ -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());