From 44ce8c6f32319e155b74b1f9eaaafef96e27e0eb Mon Sep 17 00:00:00 2001 From: Shane98c Date: Wed, 10 Feb 2021 21:10:10 -0600 Subject: [PATCH] fix unstyled flash --- pages/_document.js | 13 ++++++++++++- pages/index.js | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pages/_document.js b/pages/_document.js index 8bfdff6..9e973c3 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -4,7 +4,7 @@ import { ServerStyleSheet } from "styled-components"; export default class MyDocument extends Document { static getInitialProps({ renderPage }) { const sheet = new ServerStyleSheet(); - const page = renderPage(App => props => + const page = renderPage((App) => (props) => sheet.collectStyles() ); const styleTags = sheet.getStyleElement(); @@ -15,6 +15,17 @@ export default class MyDocument extends Document { return ( + { + + } Shane Loeffler {this.props.styleTags} diff --git a/pages/index.js b/pages/index.js index 655cee0..fe01e6f 100644 --- a/pages/index.js +++ b/pages/index.js @@ -2,6 +2,9 @@ import * as React from "react"; import Layout from "../components/Layout"; import Highlight from "../components/Highlight"; +if (process.browser) { + document.body.classList.add("loaded"); +} const projects = [ { img: "../static/img/maptheblacksnake.png",