Skip to content

No means to preemptively dismiss a single pending toast when limit != 0 #1233

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
JulianSelman opened this issue Apr 14, 2025 · 1 comment

Comments

@JulianSelman
Copy link

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!

@JulianSelman JulianSelman changed the title No means to pre-emptively dismiss a single pending toast when limit != 0 No means to preemptively dismiss a single pending toast when limit != 0 Apr 15, 2025
@JulianSelman
Copy link
Author

Here is a pull request for your consideration:
#1235

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant