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.

Static query not invalidating hash

See original GitHub issue

Looking at the guidance on caching (https://www.gatsbyjs.org/docs/caching/#static-files) I think the recent changes to static queries isn’t correct with this. @sidharthachatterjee I don’t know if this is something you can answer?

The guidance is:

All files in static/ should be cached forever

However the .json files that are output to the static/d folder look like a hash of the query (schema?) and not of the query result. Images are requested like /icons/icon-512x512.png?v=6097298229b47b2e2010b1492c6fee40, where the v seems to be a hash of something that rotates when an image has changed.

Is this ?v= supposed to be applied to the static/d/<hash>.json files as well?

Steps to recreate

  1. Create gatsby-starter-default
  2. gatsby build
  3. Observe static/d/ folder
  4. Change siteMetadata title, for example
  5. gatsby build
  6. Observe static/d/ folder, it hasn’t changed

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sidharthachatterjeecommented, Aug 6, 2020

We switch the location for static queries into public/page-data/sq/d

Fix published in gatsby@2.24.33

0reactions
danielmgzzgcommented, Oct 12, 2020

Guys, thank you so much for fixing this issue. I just wish we had found it earlier in the docs or something we have been clueless for months and tried all sort of things until we looked closely at the .json from the static queries and searched for this

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bust That Cache Through A Content Hash - Alain Schlesser
No query strings, only a static URL. Cache is only busted if this is actually needed. To meet the first requirement, we put...
Read more >
Error when preparing a multiple insert query - Stack Overflow
INSERT INTO DATABASE $sql = "INSERT INTO hashes (hash) VALUES " . implode(', ... SQLSTATE[HY093]: Invalid parameter number: parameter was not defined.
Read more >
Managing Hash Clusters - Oracle Help Center
Hashing is useful when most queries are equality queries on the cluster key and the tables in the hash cluster are primarily static...
Read more >
Guide for Caching and HTTP Cache Headers for Static Content
Without a CDN, the request for the logo would go from the user's browser to the server before it gets cached on the...
Read more >
Adding Hashes to Filenames - SurviveJS
It doesn't allow to leverage client level cache efficiently as there's no way tell whether or not a file has changed. Cache invalidation...
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