Skip to content
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

Loading Toast dismisses automatically, if toaster sets default #69

Open
JulianFlicker opened this issue Jan 25, 2023 · 3 comments
Open

Comments

@JulianFlicker
Copy link

If the Toaster configures a default duration, then toasts created with toast.loading ignore will use the default duration, instead of Infinity, like it should

<Toaster position="top-center" toastOptions={{ duration:5000 }} />

toast.loading("Message")

Expected result: the loading toast should stay there indefinitely
Actual result: the loading toast disappears after the default duration

@ardeora
Copy link
Owner

ardeora commented Jan 26, 2023

This is expected behavior 😄 You can pass overriding configs by using toast.loading("Message", {duration: Infinity}). Maybe we can add a default options on the Toaster component as well per toast style.

@JulianFlicker
Copy link
Author

This default behavior destroys toast.loading() as well as toast.promise(). As most users would expect the loading state to stay there as long as the toast is not yet successfull/errored or the promise resolved/rejected, maybe split the toasterOptions.duration on the Toaster to duration and loadingDuration, as otherwise this would very easily introduce bugs, as this is only noticeable if the promise takes longer to resolve than the set default duration.

Also overriding the duration for each toast.loading isn't possible currently, as toast.promise uses toast.loading internally, and it reuses the options for loading, success and error, therefore if i would pass in {duration:Infinity} to this function, the success and error would stay there infinitely as well.

@ardeora
Copy link
Owner

ardeora commented Jan 27, 2023

I'll take a look at this

@ardeora ardeora mentioned this issue Feb 8, 2023
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

No branches or pull requests

2 participants