Skip to content

Commit

Permalink
fix: references to window when building break the build
Browse files Browse the repository at this point in the history
  • Loading branch information
jshearer committed Sep 14, 2023
1 parent 2c5ef0e commit 44664e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/templates/blog-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dayjs.extend(reltime)

const BlogPostTemplate = ({ data: { previous, next, post }, pageContext }) => {
const postTags = post.tags.filter(tag => tag.type === "tag")
const [windowWidth, setWindowWidth] = useState(window.innerWidth)
const [windowWidth, setWindowWidth] = useState(typeof window === "undefined" ? 1500 : window.innerWidth)

const handleResize = () => {
setWindowWidth(window.innerWidth)
Expand All @@ -33,7 +33,7 @@ const BlogPostTemplate = ({ data: { previous, next, post }, pageContext }) => {
return () => {
window.removeEventListener("resize", handleResize)
}
}, [window])
}, [])

return (
<Layout headerTheme="light">
Expand Down

0 comments on commit 44664e6

Please sign in to comment.