fkhadra / fkhadra/react-toastify
No means to preemptively dismiss a single pending toast when limit != 0
- Dominant language
- TypeScript
- Stars
- 13.4k
- Forks
- 741
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I have a use case where I want to dismiss a class of toasts at the same time (say, from a single event source that has disappeared), while leaving all others displayed or pending. I am using a `ToastContainer` with a limit of 2, so sometimes the toasts I want to dismiss early are still in the queue. There's a means to entirely clear the pending queue via `toast.clearWaitingQueue`, but this is too destructive for my needs as I want to preserve any waiting toasts that are not already filtered out.
I propose that `toast.dismiss(id)` be modified such that it not only dismisses any toast by that ID but also removes it from the pending queue. I think that should be sematically valid -- I can't think of a case where you'd want to dismiss a given toast but _not_ also remove it from the pending queue if it's still there -- but if you prefer, I'd also be able to work with a `toast.removeFromWaitingQueue(id)` if the concepts should remain distinct.
I have a local commit that I can provide for PR that augments `toast.dismiss(id)` if you are amenable to this change.
Thank you for the excellent library!
Contributor guide
Assessment
This issue has not been assessed yet.