You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some notification libs have a feature like that prevents duplicate toast messages popping up and instead extends the timeout of the already present notification. This could be done by comparing content or by specifying keys (messages with the same key replace each other).
Am I missing something or would this be a feature request?
Thanks!
The text was updated successfully, but these errors were encountered:
Hey @kleinph, thanks for reaching out. The way butter-toast works at the moment is that you are the only one that controls the emission (raising) of toasts, and that BT is completely unaware of the content. One of the reasons is that BT can accept a component or a function as the toast content, which may not necessarily be equal when comparing, even if the output ends up being the same.
I do understand the need though, some events may fire twice, or multiple socket messages can send the same message. It can happen.
Thinking about the request makes me think it is not a binary thing. Sometimes you would like to not have your message appear more than once, but there may be cases in which you would (for example, a live like ticker as present in Instagram and Facebook), so I think it would be best to keep the control on the consumer side.
Here's a suggestion out of the top of my mind:
What if toasts had some sort of a mutual exclusion prop, and if a visible toast already has this tag present, the new toast won't be raised, and possibly, have its timeout reset. The mutual exclusion prop could be your text, for example - and then you, as a consumer maintain full control over this functionality.
If there was a callback when a toast is closed (whether via click or timeout), then we could implement our own de-duplication system. At the moment, I think there is on a callback for the click?
Is there a way to prevent duplicate toasts?
Some notification libs have a feature like that prevents duplicate toast messages popping up and instead extends the timeout of the already present notification. This could be done by comparing content or by specifying keys (messages with the same key replace each other).
Am I missing something or would this be a feature request?
Thanks!
The text was updated successfully, but these errors were encountered: