Skip to content

Commit

Permalink
fix: use a fresh instance of emotion cache on every request to remove…
Browse files Browse the repository at this point in the history
… FOUC bug
  • Loading branch information
m453h committed Jul 3, 2024
1 parent b4d38ef commit 5b67eab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/roboshield/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ import Page from "@/roboshield/components/Page";
import { GlobalProvider } from "@/roboshield/context/GlobalContext";
import theme from "@/roboshield/theme";
import createEmotionCache from "@/roboshield/utils/createEmotionCache";
const clientSideEmotionCache = createEmotionCache();

function getDefaultLayout(page: ReactNode, pageProps: any) {
return <Page {...pageProps}>{page}</Page>;
}

export default function App(props: AppProps | any) {
const { Component, emotionCache = clientSideEmotionCache, pageProps } = props;
const { Component, pageProps } = props;
const getLayout = Component.getLayout || getDefaultLayout;
const clientSideEmotionCache = createEmotionCache();

return (
<>
<CacheProvider value={emotionCache}>
<CacheProvider value={clientSideEmotionCache}>
<Head>
<meta name="viewport" content="initial-scale=1, width=device-width" />
<title>RoboShield</title>
Expand Down

0 comments on commit 5b67eab

Please sign in to comment.