question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add persistent toasts

See original GitHub issue

Sometimes 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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
timolinscommented, Feb 13, 2021

Thanks for the feedback! I agree with you, using Infinity seems like the more intuitive API. Will update and merge the PR 😃

2reactions
joaopaulobdaccommented, Feb 12, 2021

@timolins I think it would be better to just do if (!isFinite(duration)) { don't set timeout } and keep using the { duration: Infinity } API.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found