From 64b5568ce40ae85473df7968fb3652f25719623f Mon Sep 17 00:00:00 2001 From: Timo Lins Date: Wed, 3 Feb 2021 10:20:47 +0100 Subject: [PATCH] Allow `-1` duration for persistent toasts --- src/core/use-toaster.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/use-toaster.ts b/src/core/use-toaster.ts index 9534c85..6032be8 100644 --- a/src/core/use-toaster.ts +++ b/src/core/use-toaster.ts @@ -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);