question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Navigating between programmatically created pages doesn't update data

See original GitHub issue

Summary

We have a problem with programmatically generated pages displaying the wrong data if the user refreshes the page on any of the programmatically created pages and navigates to another. It then shows the data of the first page (the one that was refreshed).

Relevant information

We’re creating an e-commerce store sourcing products from Shopify and Articles from Prismic and have created Product and Article template components which export a gatsby build query. The query seems to work fine. But if you refresh the page while on any of the products and navigate to another product page, it shows all the data from the first one. The same happens for article pages. To clarify, it works perfectly if you refresh on anything but a product page or article page (if you refresh on a product page the articles still work and vice versa).

It wasn’t like that from the start, but I didn’t notice it until quite far down the line. If I run the product/article query in gatsby-node.js it works as expected.

I wish I knew how to duplicate this, but the only way I know is to clone our repo and unfortunately, it has to be kept private.

For a demo of the issue, you can go to this link: https://quizzical-noyce-4f2028.netlify.com/product/max-burger/ and navigate to a different product. This is the old base of our project that still has the bug present in it.

Is anyone aware of anything that could cause this? Specifically that the programmatically generated pages query data doesn’t update, even though the pageContext does?

Environment (if relevant)

System: OS: macOS 10.15.1 CPU: (12) x64 Intel® Core™ i7-8850H CPU @ 2.60GHz Shell: 5.7.1 - /bin/zsh Binaries: Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node Yarn: 1.19.2 - ~/.yarn/bin/yarn npm: 6.10.0 - ~/.nvm/versions/node/v10.15.3/bin/npm Languages: Python: 2.7.16 - /usr/bin/python Browsers: Chrome: 79.0.3945.79 Firefox: 69.0.1 Safari: 13.0.3 npmPackages: gatsby: ^2.17.7 => 2.17.7 npmGlobalPackages: gatsby-cli: 2.8.3 gatsby-source-prismic-graphql: 3.4.0-beta.2

File contents (if changed)

gatsby-config.js: N/A package.json: N/A gatsby-node.js: N/A gatsby-browser.js: N/A gatsby-ssr.js: N/A

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Dec 19, 2019

@LekoArts thanks for the Netlify suggestion. It helped me narrow down when the issue was introduced and points to 3 commits pushed a little over a month ago that enabled Prismic previews. Looks like I need to take a look at that. For documentation purposes, I will update this issue when I have the solution.

0reactions
github-actions[bot]commented, Jan 19, 2020

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

Read more comments on GitHub >

github_iconTop Results From Across the Web

Interact programmatically with the Navigation component
The Navigation component provides ways to programmatically create and interact with certain navigation elements.
Read more >
Navigates of page programmatically but address bar URL ...
I solved my issue. If you use Angular-JS , JQuery Mobile and also Angular JQM Adopter then you can achieve your requirement by...
Read more >
How to Create Pages in Next.js with Static & Dynamic Data
we want to render statically. Let's start off by creating a new directory characters inside of pages and inside, create a new file...
Read more >
Programmatically Create Pages From Data - YouTube
In this video, we will continue our progress in this #GatsbyJS series. We will work on programmatically creating pages from a #Markdown file ......
Read more >
Programmatically Navigate Using React Router - Stack Abuse
The react-router-dom package makes it simple to create new routes. ... Now, let's update the src/index.js page and import About from the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found