Loading Toast dismisses automatically, if toaster sets default
JulianFlicker opened this issue · 3 comments
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
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.
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.
I'll take a look at this