Skip to content

Commit

Permalink
Allow -1 duration for persistent toasts
Browse files Browse the repository at this point in the history
  • Loading branch information
timolins committed Feb 3, 2021
1 parent 67bdc5b commit 64b5568
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/use-toaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export const useToaster = (toastOptions?: DefaultToastOptions) => {

const now = Date.now();
const timeouts = toasts.map((t) => {
if (t.duration === -1) {
return;
}

const durationLeft =
(t.duration || 0) + t.pauseDuration - (now - t.createdAt);

Expand Down

0 comments on commit 64b5568

Please sign in to comment.