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

View File

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

View File

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