Skip to content

An opinionated toast component for React.

fix: unmount custom loading icon correctly (#365)

Dickson Wu4088630589ab
diff --git a/src/index.tsx b/src/index.tsx
index 5631b09..5ad4964 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -219,7 +219,7 @@ const Toast = (props: ToastProps) => {
function getLoadingIcon() {
if (icons?.loading) {
return (
- <div className="loader" data-visible={toastType === 'loading'}>
+ <div className="sonner-loader" data-visible={toastType === 'loading'}>
{icons.loading}
</div>
);
@@ -366,7 +366,7 @@ const Toast = (props: ToastProps) => {
{toastType || toast.icon || toast.promise ? (
<div data-icon="">
{toast.promise || (toast.type === 'loading' && !toast.icon)
- ? toast.icon || icons?.loading || getLoadingIcon()
+ ? toast.icon || getLoadingIcon()
: null}
{toast.type !== 'loading' ? toast.icon || icons?.[toastType] || getAsset(toastType) : null}
</div>