1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-13 08:02:38 +03:00

Ensure notification badges stop listening when they unmount

This commit is contained in:
Travis Ralston
2020-07-24 13:59:09 -06:00
parent fbdbbce529
commit 593b472e50

View File

@@ -72,6 +72,9 @@ export default class NotificationBadge extends React.PureComponent<XOR<IProps, I
public componentWillUnmount() { public componentWillUnmount() {
SettingsStore.unwatchSetting(this.countWatcherRef); SettingsStore.unwatchSetting(this.countWatcherRef);
if (this.props.notification) {
this.props.notification.off(NOTIFICATION_STATE_UPDATE, this.onNotificationUpdate);
}
} }
public componentDidUpdate(prevProps: Readonly<IProps>) { public componentDidUpdate(prevProps: Readonly<IProps>) {