File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -53,15 +53,18 @@ const PeopleTpl = (props: PageProps<Queries.PeopleTplQuery>) => {
5353 const genericAvatar = defaultAvatar . edges [ 0 ] . node . childImageSharp ;
5454
5555 // For routing to a specific person
56- const personId = window . location . pathname
57- . replace ( "/people/" , "" )
58- . replace ( "/" , "" ) ;
59- const personObj = all . edges . find (
60- ( { node } : { node : PersonNode } ) => node . frontmatter ?. uid === personId
61- ) ;
56+ let personObj
57+ if ( typeof window !== "undefined" ) {
58+ const personId = window . location . pathname
59+ . replace ( "/people/" , "" )
60+ . replace ( "/" , "" ) ;
61+ personObj = all . edges . find (
62+ ( { node } : { node : PersonNode } ) => node . frontmatter ?. uid === personId
63+ ) ?. node ;
64+ }
6265
6366 const [ currentPerson , setCurrentPerson ] = useState < PersonNode | null > (
64- personObj ?. node ?? null
67+ personObj ?? null
6568 ) ;
6669
6770 // from the <Modal /> component when it closes force a navigation back to
You can’t perform that action at this time.
0 commit comments