Skip to content

Commit

Permalink
Fix theme variable load when enableDarkMode=false
Browse files Browse the repository at this point in the history
  • Loading branch information
taneliang committed Sep 3, 2020
1 parent dce4389 commit 40a5d22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/react-devtools-scheduling-profiler/src/hooks.js
Expand Up @@ -40,9 +40,8 @@ export function useBrowserTheme(): void {
const theme = useMutableSource(darkModeMutableSource, getSnapshot, subscribe);

useLayoutEffect(() => {
const documentElements = [((document.documentElement: any): HTMLElement)];
if (enableDarkMode) {
const documentElements = [((document.documentElement: any): HTMLElement)];

switch (theme) {
case 'light':
updateThemeVariables('light', documentElements);
Expand All @@ -53,6 +52,8 @@ export function useBrowserTheme(): void {
default:
throw Error(`Unsupported theme value "${theme}"`);
}
} else {
updateThemeVariables('light', documentElements);
}
}, [theme]);
}

0 comments on commit 40a5d22

Please sign in to comment.