From 356e02867ac9f8c8755a4acf2d0b1d5355be1c6b Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sun, 25 Jun 2023 10:43:50 +0930 Subject: [PATCH] fix(alerts): fix previous alert with same key not being dismissed --- src/alerts/alerts.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/alerts/alerts.ts b/src/alerts/alerts.ts index ba67ff9..14d4cc3 100644 --- a/src/alerts/alerts.ts +++ b/src/alerts/alerts.ts @@ -47,6 +47,8 @@ export default class AlertsElement extends HTMLElement { public show(el: HTMLElement, options: AlertOptions = {}) { const key = options.key || el.dataset.key || String(this.index++); + this.dismiss(key); + el.dataset.key = key; if (!this.contains(el)) {