Skip to content

Commit

Permalink
fix: clear timeout before pausing toast timer
Browse files Browse the repository at this point in the history
  • Loading branch information
tutkli committed Feb 20, 2024
1 parent 01ced11 commit 9bb7039
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libs/ngx-sonner/src/lib/toast.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,16 @@ export class ToastComponent implements AfterViewInit, OnDestroy {
}
});

effect(() => {
effect(onCleanup => {
if (!this.isPromiseLoadingOrInfiniteDuration()) {
if (this.expanded() || this.interacting()) {
this.pauseTimer();
} else {
this.startTimer();
}
}

onCleanup(() => clearTimeout(this.timeoutId));
});

effect(() => {
Expand Down

0 comments on commit 9bb7039

Please sign in to comment.