Gatsby: Navigation cache bug in JQuery crashes app

Created on 27 Jan 2020  路  7Comments  路  Source: gatsbyjs/gatsby

After successfully building, this error suddenly comes in at one point:

TypeError: document.getElementById(...) is null
componentDidUpdate/<
project/.cache/navigation.js:173

  170 | if (document.title) {
  171 |   pageName = document.title
  172 | }
> 173 | const pageHeadings = document
  174 |   .getElementById(`gatsby-focus-wrapper`)
  175 |   .getElementsByTagName(`h1`)
  176 | if (pageHeadings && pageHeadings.length) {

Thank you
And I'm available to help

Most helpful comment

Still having this issue - any fixes in sight? Updating doesn't appear to make any difference.

All 7 comments

Hi @pedro-surf!

Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look.

Thanks for using Gatsby! :purple_heart:

same problem, any solution?

Same problem here

Fixed and published in [email protected]

Apologies for this.

I'm still having this issue even though I'm using gatsby 2.19.12
It weirdly seems to occur only when using Gatsby Image.

I'm also still getting this. This was on an older project that I was in the process of updating dependencies on. The dependencies that were updated were

  • gatsby 2.13.60 to 2.19.18
  • gatsby-image 2.2.34 to 2.2.41

It was part of a larger ncu update but since I saw this thread and it is the same issue I think this is probably the root cause.

Still having this issue - any fixes in sight? Updating doesn't appear to make any difference.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rossPatton picture rossPatton  路  3Comments

kalinchernev picture kalinchernev  路  3Comments

timbrandin picture timbrandin  路  3Comments

jimfilippou picture jimfilippou  路  3Comments

brandonmp picture brandonmp  路  3Comments