Feature request: Be able to update all existing toasts without knowing their ids
Do you want to request a feature or report a bug? Feature
What is the current behavior? When I want to update a toast, I have to know its id
toats.update(toastId, { /* options */ })
What is the expected behavior? I want to update all current toasts that are showing on the screen, without knowing all their ids and iterating through.
toast.update(null, { /* options */ }) // or another signature like `toast.update(options)`
It will work just like toast.dismiss() which closes all existing toasts without passing all their ids in.
Hey @xsjcTony, not sure this is something that I would put in core. You can already implement such functionality.
const ids = []
// everytime you call toast, you would store the id
ids.push(toast("something"))
function updateAll(opts){
ids.forEach(id => toast.update(id, opts))
}
It could potentially be an addon
@fkhadra Yeah such functionality can be implemented but since toast can be triggered anywhere in the component tree, I may need an extra global state for storing ids which is an extra cost, that's why I think such a feature would be great.