fix(AbstractNotificationsContainer): broken timeouts chain

If user dismisses the not topmost notification the timeout will be
cleared and a new one will not be set, because the top notification
remained the same (see the if at line 90).
This commit is contained in:
paweldomas 2019-02-08 13:42:20 -06:00 committed by Zoltan Bettenbuk
parent 95f684da2f
commit 64f8a8d700
1 changed files with 7 additions and 1 deletions

View File

@ -142,7 +142,13 @@ export default class AbstractNotificationsContainer<P: Props>
* @returns {void} * @returns {void}
*/ */
_onDismissed(uid) { _onDismissed(uid) {
const { _notifications } = this.props;
// Clear the timeout only if it's the top notification that's being
// dismissed (the timeout is set only for the top one).
if (!_notifications.length || _notifications[0].uid === uid) {
this._clearNotificationDismissTimeout(); this._clearNotificationDismissTimeout();
}
this.props.dispatch(hideNotification(uid)); this.props.dispatch(hideNotification(uid));
} }