diff --git a/src/index.tsx b/src/index.tsx index 6bb7dc9..21a37c8 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -431,7 +431,12 @@ const Toaster = (props: ToasterProps) => { }, []); React.useEffect(() => { - if (theme !== 'system' || typeof window === 'undefined') return; + if (theme !== 'system') { + setActualTheme(theme); + return; + } + + if (typeof window === 'undefined') return; window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', ({ matches }) => { if (matches) {