gatsby: Gatsby V4, links for pages don't work on normal browsing but work in incognito mode, devtool and dev/serve mode

Preliminary Checks

Description

UPDATE: the below issue disappears if I do hard reload on Chrome. But after some time it comes back. So I would like to know what’s causing this error to see if I can do anything about it.

It started to appear after I upgraded to V4 a while ago. Mostly single blog page would work everywhere. The ones that don’t work well are the ones that are pages, including the pages like /tags/food, particularly those in the navigation.

Links worked fine in gatsby dev and gatsby serve, exactly as expected. After deployed to Netlify, I’ve also tested them both in Chrome and Firefox. They worked perfectly when you have “inspect” dev tool open, or in incognito or private mode. So in all, it works

  • dev / serve in local development
  • inspect dev tool mode
  • incognito mode
  • when you open the link in another tab

The only time it doesn’t work is when you just browse normally… it would either load a blank page (if you refresh it would of course load fine again), or doesn’t do anything at all. And the console error is often like this:

Uncaught TypeError: l.ZP.loadPage(...).then is not a function
    at w (121855582369c7d8b0d63076256c0559e31c8137.js:1)
    at window.___navigate (121855582369c7d8b0d63076256c0559e31c8137.js:1)
    at Object.onClick (121855582369c7d8b0d63076256c0559e31c8137.js:1)
    at onClick (121855582369c7d8b0d63076256c0559e31c8137.js:1)
    at Object.o (121855582369c7d8b0d63076256c0559e31c8137.js:1)
    at p (121855582369c7d8b0d63076256c0559e31c8137.js:1)
    at 121855582369c7d8b0d63076256c0559e31c8137.js:1
    at g (121855582369c7d8b0d63076256c0559e31c8137.js:1)
    at ot (121855582369c7d8b0d63076256c0559e31c8137.js:1)
    at it (121855582369c7d8b0d63076256c0559e31c8137.js:1)

Since I am not sure this could be reproduced properly with minimal production, I can’t provide one as it might just work?

Reproduction Link

https://www.petiteandminimal.com/

Steps to Reproduce

  1. Just go to my site and browse as usual and if you experience problems above.
  2. If so, try again in incognito mode and see if problem disappeared.

Expected Result

Links should work as usual, when you click on something it leads you to the new page.

Actual Result

Links as pages or /tags/food etc don’t work properly sometimes.

Environment

System:
    OS: Linux 5.4 Linux Mint 20 (Ulyana)
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node
    Yarn: 1.22.10 - /usr/bin/yarn
    npm: 8.1.1 - ~/.nvm/versions/node/v14.18.1/bin/npm
  Browsers:
    Chrome: 96.0.4664.93
    Firefox: 95.0
  npmPackages:
    gatsby: ^4.0.0 => 4.0.0 
    gatsby-image: ^2.3.5 => 2.11.0 
    gatsby-plugin-algolia: ^0.22.2 => 0.22.2 
    gatsby-plugin-google-gtag: ^4.1.0-next.0 => 4.1.0-next.0 
    gatsby-plugin-html-attributes: ^1.0.5 => 1.0.5 
    gatsby-plugin-image: ^2.1.0-next.0 => 2.1.0-next.0 
    gatsby-plugin-manifest: ^4.1.0-next.0 => 4.1.0-next.0 
    gatsby-plugin-offline: ^5.1.0-next.0 => 5.1.0-next.0 
    gatsby-plugin-react-helmet: ^5.1.0-next.0 => 5.1.0-next.0 
    gatsby-plugin-remove-fingerprints: 0.0.2 => 0.0.2 
    gatsby-plugin-robots-txt: ^1.5.6 => 1.5.6 
    gatsby-plugin-sharp: ^4.1.0-next.0 => 4.1.0-next.0 
    gatsby-plugin-sitemap: ^5.1.0-next.0 => 5.1.0-next.0 
    gatsby-plugin-styled-components: ^5.1.0-next.0 => 5.1.0-next.0 
    gatsby-remark-images: ^6.1.0-next.0 => 6.1.0-next.0 
    gatsby-source-filesystem: ^4.1.0-next.0 => 4.1.0-next.0 
    gatsby-transformer-remark: ^5.1.0-next.0 => 5.1.0-next.0 
    gatsby-transformer-sharp: ^4.1.0-next.0 => 4.1.0-next.0

Config Flags

NO

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 17 (9 by maintainers)

Most upvoted comments

@mikaelbang

Wow this did that magic. I just published and tested it on my firefox (old cache no clearing) and now it works as expected. @rjoonas @trivedip you can perhaps give it a try too (I assume if you have similar setting that is).