Skip to content

Commit

Permalink
Merge branch 'fix/174-exit-animation-last-toast'
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnartorfis committed Dec 10, 2024
2 parents c975153 + 83057c2 commit 7fc8404
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/toaster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
type ToastRef,
} from './types';
import { areToastsEqual } from './toast-comparator';
import { ANIMATION_DURATION } from './animations';

let addToastHandler: AddToastContextHandler;
let dismissToastHandler: typeof toast.dismiss;
Expand All @@ -37,7 +38,7 @@ export const Toaster: React.FC<ToasterProps> = ({
// let the animation finish
const timeout = setTimeout(() => {
setToastsVisible(false);
}, 300);
}, ANIMATION_DURATION);

return () => clearTimeout(timeout);
}, [toasts.length]);
Expand Down

0 comments on commit 7fc8404

Please sign in to comment.