From ded2082e0d10d89d4979b554e9ed3c26f0db8dd7 Mon Sep 17 00:00:00 2001 From: Tim Auf dem Kampe Date: Wed, 15 Jan 2025 13:16:11 +0100 Subject: [PATCH] fix(Notification): Fix "Timer not started" error for notifications that should not auto close --- .../ControlledNotification.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/components/src/components/NotificationProvider/ControlledNotification.tsx b/packages/components/src/components/NotificationProvider/ControlledNotification.tsx index 577cf8206..37679e7d8 100644 --- a/packages/components/src/components/NotificationProvider/ControlledNotification.tsx +++ b/packages/components/src/components/NotificationProvider/ControlledNotification.tsx @@ -15,20 +15,28 @@ export const ControlledNotification: FC = (props) => { return cloneElement(notification.element, { onMouseEnter: () => { - notification.meta.autoCloseTimer.pause(); + if (notification.element.props.autoClose) { + notification.meta.autoCloseTimer.pause(); + } }, onMouseLeave: () => { - notification.meta.autoCloseTimer.resume(); + if (notification.element.props.autoClose) { + notification.meta.autoCloseTimer.resume(); + } }, onClose: () => { controller.remove(notification.meta.id); notification.element.props.onClose?.(); }, onFocus: () => { - notification.meta.autoCloseTimer.pause(); + if (notification.element.props.autoClose) { + notification.meta.autoCloseTimer.pause(); + } }, onBlur: () => { - notification.meta.autoCloseTimer.resume(); + if (notification.element.props.autoClose) { + notification.meta.autoCloseTimer.resume(); + } }, }); };