Skip to content

Commit

Permalink
fix: handle nullish announcementRef to fix client side redirect error (
Browse files Browse the repository at this point in the history
  • Loading branch information
dehamzah authored May 11, 2020
1 parent 49dfc6f commit 7a23392
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/gatsby/cache-dir/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,11 @@ class RouteAnnouncer extends React.Component {
pageName = pageHeadings[0].textContent
}
const newAnnouncement = `Navigated to ${pageName}`
const oldAnnouncement = this.announcementRef.current.innerText
if (oldAnnouncement !== newAnnouncement) {
this.announcementRef.current.innerText = newAnnouncement
if (this.announcementRef.current) {
const oldAnnouncement = this.announcementRef.current.innerText
if (oldAnnouncement !== newAnnouncement) {
this.announcementRef.current.innerText = newAnnouncement
}
}
})
}
Expand Down

0 comments on commit 7a23392

Please sign in to comment.