diff --git a/src/components/theme/ThemeProvider.tsx b/src/components/theme/ThemeProvider.tsx index 7e25311098..ccebe5756d 100644 --- a/src/components/theme/ThemeProvider.tsx +++ b/src/components/theme/ThemeProvider.tsx @@ -38,11 +38,16 @@ export function ThemeProvider({ ) as RealTheme; const themeValue = theme === 'system' ? systemTheme : theme; - const prevRootClassName = React.useRef(''); + const prevRootClassName = React.useRef(''); React.useEffect(() => { if (!scoped) { - updateBodyClassName(themeValue, {'native-scrollbar': nativeScrollbar}, rootClassName, rootClassName.current); + updateBodyClassName( + themeValue, + {'native-scrollbar': nativeScrollbar}, + rootClassName, + prevRootClassName.current, + ); prevRootClassName.current = rootClassName; } }, [nativeScrollbar, themeValue, scoped, rootClassName]);