Add persistent toasts
See original GitHub issueSometimes we need to show toast until it’s dismissed by user or programmatically. E. g. connection lost and notification is shown until it’s back online. Or some long or slow process happens.
It is not always possible to use toast.promise
for that. Currently I use very long duration to simulate persistent toast.
Is it possible to add persistent toast, which doesn’t have any timers inside them? Then it would possible to do:
const id = toast('No connection.', { persistent: true });
toast('Connected.', { id, persistent: false })
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Recipe: Make toasts stay visible (persistence) - OpenFin Docs
If a notification toast contains very important information, It can be useful to make it stay visible on the desktop until the user...
Read more >Toasts · Bootstrap v5.0
Toasts are lightweight notifications designed to mimic the push notifications that have been popularized by mobile and desktop operating systems.
Read more >toast() API
Call it to create a toast from anywhere, even outside React. Make sure you add the <Toaster/> component to your app first.
Read more >Toasts overview - Android Developers
Instantiate a Toast object · The application Context . · The text that should appear to the user. · The duration that the...
Read more >Persistent Toast Message: Toast won't disappear after execution
Toast stays a little longer. It will always disappear once generated. As in loop they are getting continuously generated upon ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the feedback! I agree with you, using Infinity seems like the more intuitive API. Will update and merge the PR 😃
@timolins I think it would be better to just do
if (!isFinite(duration)) { don't set timeout }
and keep using the{ duration: Infinity }
API.