chore: disable nextjs ssr

This commit is contained in:
Anoop M D 2021-12-30 19:42:04 +05:30
parent 1b95cda707
commit f9e7d1463b
3 changed files with 17 additions and 11 deletions

View File

@ -33,11 +33,6 @@ import 'codemirror/addon/hint/show-hint.css';
const RequestTabPanel = dynamic(import('@grafnode/components').then(mod => mod.RequestTabPanel), { ssr: false });
export default function Main() {
// disable ssr
if(typeof window === 'undefined') {
return null;
}
const [state, dispatch] = useStore();
const {
@ -72,5 +67,6 @@ export default function Main() {
</section>
</StyledWrapper>
</div>
)
}
);
};

View File

@ -6,11 +6,21 @@ import 'react-tabs/style/react-tabs.css';
import 'codemirror/lib/codemirror.css';
import 'graphiql/graphiql.min.css';
function SafeHydrate({ children }) {
return (
<div suppressHydrationWarning>
{typeof window === 'undefined' ? null : children}
</div>
)
}
function MyApp({ Component, pageProps }) {
return (
<StoreProvider>
<Component {...pageProps} />
</StoreProvider>
<SafeHydrate>
<StoreProvider>
<Component {...pageProps} />
</StoreProvider>
</SafeHydrate>
);
}

View File

@ -2,7 +2,7 @@ html, body {
margin: 0;
padding: 0;
font-size: 1rem;
color: rgb(62 62 62);
color: rgb(48 48 48);
font-kerning: none;
text-rendering: optimizeSpeed;