Add a warning for dismissing invalid toasts

pull/21833/head
Travis Ralston 2020-06-04 13:53:09 -06:00
parent c667ea69af
commit 3674b6446e
1 changed files with 5 additions and 0 deletions

View File

@ -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++;
}