Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

automatically cache busting the json files based on the hash in meta tag#1648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
atflick wants to merge2 commits intogridsome:master
base:master
Choose a base branch
Loading
fromatflick:fix/auto-cache-bust-json-files

Conversation

@atflick
Copy link

@atflickatflick commentedAug 19, 2022
edited
Loading

Problem: json files get cached and when they are fetched their hash doesn't match the hash that gridsome generated in the HTML that's fetching the json files. This results in theHash did not match error which then breaks all pages until the user clears their cache.

This change simply adds the matching hash as a query param when the json files are fetched, meaning they can still be cached until that hash changes in which they should be freshly fetched.

This is the hash being added in the network tab:
image

a-kriya and ai-slave reacted with thumbs up emoji
@atflickatflick changed the titleautomatically cache busting the json files based on the has in meta tagautomatically cache busting the json files based on the hash in meta tagAug 19, 2022
@atflickatflick mentioned this pull requestAug 19, 2022
@atflick
Copy link
Author

Solves this issue:#1032

@ai-slave
Copy link

@hjvedvik can you please merge this one?

atflick and cri5h reacted with thumbs up emoji

@atflick
Copy link
Author

bumping this again@hjvedvik

This would greatly increase the confidence I have when deploying new changes to our public site. We recently had a situation where there were a bunch of updates made to our site that got deployed earlier than we wanted and we rolled them back quickly but the json files were getting cached on the client side which was completely breaking the site for any users who had visited the newly updated version, then the rolled back version. Similar situation happens on consecutive quick changes/updates

@atflick
Copy link
Author

@hjvedvik bumping this again, this simple change would help anyone still using gridsome out A LOT.

@sergeyfilimonov
Copy link
Contributor

sergeyfilimonov commentedAug 28, 2023
edited
Loading

@atflick how is this code working? there is nohash variable defined in the file so the build goeshash is undefined. So for now I've just changed/index.json in the file to/index.json?h=Math.floor(Math.random() * 1000000000000000)

@atflick
Copy link
Author

@sergeyfilimonov That works too, but thehash variable should be getting defined just above on line 57. Maybe it doesn't get defined in certain situations. It's been a while since I looked at this.

image

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@atflick@ai-slave@sergeyfilimonov

[8]ページ先頭

©2009-2025 Movatter.jp