Skip to content

feat: loading toast will go away after 10s & added a optional prop fo… #626

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

harisiqbal12
Copy link

  1. Auto-dismissal : Loading toasts now automatically dismiss after a specified timeout (defaults to 10 seconds if not provided).
  2. Configurable timeout : Developers can specify a custom timeout duration through the new timeout parameter.
  3. Cancel button support : Loading toasts can now include a cancel button, providing users with a way to manually dismiss the toast before the timeout expires.
  4. Improved UX : This prevents loading toasts from staying on screen indefinitely if an operation fails silently or takes too long.
  • The method now accepts an extended type that includes the optional timeout parameter.
  • A setTimeout is used to automatically dismiss the toast after the specified duration.
  • The default timeout is 10000ms (10 seconds) if not explicitly provided.
  • The implementation maintains backward compatibility with existing code.

Copy link

vercel bot commented Apr 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sonner ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 30, 2025 6:30pm

@vaizakhter
Copy link

This is very nice feature that is required please add this my website gets stuck with loading something even when i trigger the dismiss function.

@SteeveSticks
Copy link

This is very nice
Please get merged

@emilkowalski
Copy link
Owner

I appreciate your contribution, but I don’t think this is necessary. Some actions can theoretically take longer than 10 seconds, and this introduces unnecessary confusion. I want the consumers of this library to be aware of potential long loading times and handle them themselves.

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

Successfully merging this pull request may close these issues.

5 participants