Skip to content

Commit c5ca53f

Browse files
author
joachimzeelmaekers
committed
refactor: remove emotion cache to stop logos from flashing
1 parent e720b80 commit c5ca53f

File tree

4 files changed

+13
-27
lines changed

4 files changed

+13
-27
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
},
1111
"dependencies": {
1212
"@datacamp/waffles": "5.12.0",
13-
"@emotion/cache": "^11.13.1",
1413
"@emotion/react": "^11.13.3",
1514
"@emotion/styled": "^11.13.0",
1615
"@octokit/graphql": "^4.5.8",

pages/_app.tsx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
import '../styles/index.css';
22

33
import { ToastProvider } from '@datacamp/waffles/toast';
4-
import createCache from '@emotion/cache';
5-
import { CacheProvider } from '@emotion/react';
64
import type { AppProps } from 'next/app';
75
import { createContext, useEffect, useState } from 'react';
86
import ReactGA4 from 'react-ga4';
97

108
import * as gtag from '../lib/gtag';
119

12-
const emotionCache = createCache({ key: 'rdocs' });
13-
1410
export const ThemeContext = createContext({
1511
theme: 'light',
1612
toggleTheme: () => null,
1713
});
1814

1915
export default function MyApp({ Component, pageProps }: AppProps) {
20-
const [theme, setTheme] = useState('light');
16+
const [theme, setTheme] = useState<string>();
2117

2218
function toggleTheme() {
2319
if (theme === 'light') {
@@ -44,12 +40,10 @@ export default function MyApp({ Component, pageProps }: AppProps) {
4440
}, [theme]);
4541

4642
return (
47-
<CacheProvider value={emotionCache}>
48-
<ThemeContext.Provider value={{ theme, toggleTheme }}>
49-
<ToastProvider>
50-
<Component {...pageProps} />
51-
</ToastProvider>
52-
</ThemeContext.Provider>
53-
</CacheProvider>
43+
<ThemeContext.Provider value={{ theme, toggleTheme }}>
44+
<ToastProvider>
45+
<Component {...pageProps} />
46+
</ToastProvider>
47+
</ThemeContext.Provider>
5448
);
5549
}

pages/_document.tsx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
/* eslint-disable class-methods-use-this */
2-
import Document, {
3-
DocumentContext,
4-
Head,
5-
Html,
6-
Main,
7-
NextScript,
8-
} from 'next/document';
9-
10-
class MyDocument extends Document {
11-
static async getInitialProps(ctx: DocumentContext) {
12-
const initialProps = await Document.getInitialProps(ctx);
13-
return { ...initialProps };
14-
}
2+
import NextDocument, { Head, Html, Main, NextScript } from 'next/document';
153

4+
class MyDocument extends NextDocument {
5+
// static async getInitialProps(ctx: DocumentContext) {
6+
// const initialProps = await Document.getInitialProps(ctx);
7+
// return { ...initialProps };
8+
// }
169
render() {
1710
return (
1811
<Html lang="en">

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
source-map "^0.5.7"
272272
stylis "4.2.0"
273273

274-
"@emotion/cache@^11.13.0", "@emotion/cache@^11.13.1":
274+
"@emotion/cache@^11.13.0":
275275
version "11.13.1"
276276
resolved "https://registry.yarnpkg.com/@emotion/cache/-/cache-11.13.1.tgz#fecfc54d51810beebf05bf2a161271a1a91895d7"
277277
integrity sha512-iqouYkuEblRcXmylXIwwOodiEK5Ifl7JcX7o6V4jI3iW4mLXX3dmt5xwBtIkJiQEXFAI+pC8X0i67yiPkH9Ucw==

0 commit comments

Comments
 (0)