From 3674b6446e4acddffdaf3a3c2c672f5bc53e810a Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 4 Jun 2020 13:53:09 -0600 Subject: [PATCH] Add a warning for dismissing invalid toasts --- src/stores/ToastStore.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/stores/ToastStore.ts b/src/stores/ToastStore.ts index 55c48c3937..3fa2f4b11f 100644 --- a/src/stores/ToastStore.ts +++ b/src/stores/ToastStore.ts @@ -68,6 +68,11 @@ export default class ToastStore extends EventEmitter { } dismissToast(key) { + if (!this.toasts.some(t => t.key === key)) { + console.warn(`No toast for ${key} found - cannot dismiss. Check your toastKey`); + return; + } + if (this.toasts[0] && this.toasts[0].key === key) { this.countSeen++; }