From 9a4f669c2d31d4424ce9a986888ff8bf1f20627b Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Fri, 11 Jan 2019 23:07:17 -0500 Subject: [PATCH] Adding initial shot at handling build issues --- src/components/App/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/App/index.js b/src/components/App/index.js index e201f78..9b4109d 100644 --- a/src/components/App/index.js +++ b/src/components/App/index.js @@ -76,11 +76,13 @@ const createPngLink = async ({ svg, width, height }) => { }; class App extends React.PureComponent { - state={ - ...readURLHash() - } + state={} componentDidMount() { + // Gatsby doesn't have document.location, so readURLHash can't be called + // until here + this.setState(readURLHash()); + window.addEventListener('hashchange', this.handleHashChange); this.handleHashChange(); } @@ -144,7 +146,7 @@ class App extends React.PureComponent { }; return -
+ { syntax && }