Skip to content

Commit d305f66

Browse files
committed
switch to useRef to ensure single render
1 parent 785aad7 commit d305f66

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

static/app/components/themeAndStyleProvider.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Fragment, lazy, useEffect, useMemo} from 'react';
1+
import {Fragment, lazy, useMemo, useRef} from 'react';
22
import {createPortal} from 'react-dom';
33
import createCache from '@emotion/cache';
44
import {CacheProvider, ThemeProvider} from '@emotion/react';
@@ -61,11 +61,12 @@ export function ThemeAndStyleProvider({children}: Props) {
6161
useHotkeys(themeToggleHotkey);
6262

6363
const theme = config.theme === 'dark' ? darkTheme : lightTheme;
64-
useEffect(() => {
65-
if (NODE_ENV !== 'development') {
66-
printConsoleBanner(theme.colors.blue400, theme.text.familyMono);
67-
}
68-
}, [theme]);
64+
65+
const didPrintBanner = useRef(false);
66+
if (!didPrintBanner.current && NODE_ENV !== 'development') {
67+
didPrintBanner.current = true;
68+
printConsoleBanner(theme.colors.blue400, theme.text.familyMono);
69+
}
6970

7071
return (
7172
<ThemeProvider theme={theme}>

0 commit comments

Comments
 (0)