diff --git a/packages/eds-core-react/src/components/Snackbar/Snackbar.tsx b/packages/eds-core-react/src/components/Snackbar/Snackbar.tsx index 624cf24ed3..c935489e15 100644 --- a/packages/eds-core-react/src/components/Snackbar/Snackbar.tsx +++ b/packages/eds-core-react/src/components/Snackbar/Snackbar.tsx @@ -98,15 +98,14 @@ export const Snackbar = forwardRef( useEffect(() => { setVisible(open) - - timer.current = setTimeout(() => { - setVisible(false) - - if (onClose) { - onClose() - } - }, autoHideDuration) - + if (open) { + timer.current = setTimeout(() => { + setVisible(false) + if (onClose) { + onClose() + } + }, autoHideDuration) + } return () => clearTimeout(timer.current) }, [open, autoHideDuration, setVisible, onClose])