Update src/App.tsx

Co-authored-by: Robin <robin@robin.town>
This commit is contained in:
Timo
2024-02-22 09:29:11 +01:00
committed by GitHub
parent ab62f578f7
commit f8a3ad3760

View File

@@ -69,7 +69,7 @@ const ThemeProvider: FC<ThemeProviderProps> = ({ children }) => {
const [previousTheme, setCurrentTheme] = useState<string | null>( const [previousTheme, setCurrentTheme] = useState<string | null>(
document.body.classList.item(0), document.body.classList.item(0),
); );
useEffect(() => { useLayoutEffect(() => {
// Don't update the current theme if the url does not contain a theme prop. // Don't update the current theme if the url does not contain a theme prop.
if (!theme) return; if (!theme) return;
const themeString = "cpd-theme-" + (theme ?? "dark"); const themeString = "cpd-theme-" + (theme ?? "dark");