Skip to content

Commit

Permalink
fix: cache problem
Browse files Browse the repository at this point in the history
  • Loading branch information
tc-imba committed Jun 25, 2024
1 parent 41468e0 commit dbfad04
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 8 deletions.
4 changes: 4 additions & 0 deletions gatsby-theme-academic/gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ import {
} from './src/utils/providers';

export const wrapPageElement = _wrapPageElement;

export function onServiceWorkerUpdateReady() {
window.location.reload(true);
};
24 changes: 23 additions & 1 deletion gatsby-theme-academic/gatsby-config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ const config = ({
},
},
},
'gatsby-plugin-offline',
'gatsby-plugin-lodash',
{
resolve: 'gatsby-source-filesystem',
Expand All @@ -96,6 +95,29 @@ const config = ({
// versions prior to iOS 11.3.
},
},
{
resolve:`gatsby-plugin-netlify`,
options: {
headers: {
"/public/**/*.html": [
"cache-control: public",
"cache-control: max-age=0",
"cache-control: must-revalidate"
],
"/public/sw.js": [
"cache-control: public",
"cache-control: max-age=0",
"cache-control: must-revalidate"
],
"/public/page-data/*": [
"cache-control: public",
"cache-control: max-age=0",
"cache-control: must-revalidate"
]
}
}
},
'gatsby-plugin-offline',
{
resolve: 'gatsby-source-filesystem',
options: {
Expand Down
1 change: 1 addition & 0 deletions gatsby-theme-academic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"gatsby-plugin-manifest": "^5.13.1",
"gatsby-plugin-mdx": "^5.13.1",
"gatsby-plugin-nprogress": "^5.13.1",
"gatsby-plugin-netlify": "^5.1.1",
"gatsby-plugin-offline": "^6.13.1",
"gatsby-plugin-react-helmet": "^6.13.1",
"gatsby-plugin-robots-txt": "^1.8.0",
Expand Down
6 changes: 3 additions & 3 deletions gatsby-theme-academic/src/components/Seo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ function SEO({
{ name: 'twitter:site', content: siteMetadata.author },
{ name: 'twitter:creator', content: siteMetadata.author },
/* HTTP no cache */
{ 'http-equiv': 'Cache-Control', content: 'no-cache, no-store, must-revalidate' },
{ 'http-equiv': 'Pragma', content: 'no-cache' },
{ 'http-equiv': 'Expires', content: '0' },
// { 'http-equiv': 'Cache-Control', content: 'no-cache, no-store, must-revalidate' },
// { 'http-equiv': 'Pragma', content: 'no-cache' },
// { 'http-equiv': 'Expires', content: '0' },
]
.concat(metaKeywords) // Keywords
.concat(meta || []) // Other provided metadata
Expand Down
76 changes: 72 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@
dependencies:
regenerator-runtime "^0.14.0"

"@babel/runtime@^7.3.4":
"@babel/runtime@^7.16.7", "@babel/runtime@^7.3.4":
version "7.24.4"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.4.tgz#de795accd698007a66ba44add6cc86542aff1edd"
integrity sha512-dkxf7+hn8mFBwKjs9bvBlArzLVxVbS8usaPUDd5p2a9JCL9tB8OaOVN1isD4+Xyk4ns89/xeOmbQvgdK7IIVdA==
Expand Down Expand Up @@ -6297,6 +6297,15 @@ [email protected], fs-exists-cached@^1.0.0:
resolved "https://registry.yarnpkg.com/fs-exists-cached/-/fs-exists-cached-1.0.0.tgz#cf25554ca050dc49ae6656b41de42258989dcbce"
integrity sha512-kSxoARUDn4F2RPXX48UXnaFKwVU7Ivd/6qpzZL29MCDmr9sTvybv4gFCp+qaI4fM9m0z9fgz/yJvi56GAz+BZg==

fs-extra@^11.0.0:
version "11.2.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b"
integrity sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==
dependencies:
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^2.0.0"

fs-extra@^11.1.1:
version "11.1.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.1.1.tgz#da69f7c39f3b002378b0954bb6ae7efdc0876e2d"
Expand Down Expand Up @@ -6428,7 +6437,7 @@ gatsby-cli@^5.13.2:
yoga-layout-prebuilt "^1.10.0"
yurnalist "^2.1.0"

gatsby-core-utils@^4.13.1:
gatsby-core-utils@^4.0.0, gatsby-core-utils@^4.13.1:
version "4.13.1"
resolved "https://registry.yarnpkg.com/gatsby-core-utils/-/gatsby-core-utils-4.13.1.tgz#57955316486cc85ab150922f481484bc9287205e"
integrity sha512-w7G6SsQr8T2q+AJ1MxvRNGocCt+wjc22MiRLj2Zi3Ijpjszbr818JxwI4+aPt8WOSHlKT5SYCHICnEvcYPm9gg==
Expand Down Expand Up @@ -6624,6 +6633,18 @@ gatsby-plugin-mdx@^5.13.1:
unist-util-visit "^4.1.2"
vfile "^5.3.7"

gatsby-plugin-netlify@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/gatsby-plugin-netlify/-/gatsby-plugin-netlify-5.1.1.tgz#c9497133fca784900df7a80c31c47853fabdcae7"
integrity sha512-CembvYjbP7NJvVIdffqWaBKXMHIxYBKBEoXFGvCKX+8phRNkfmjnvoljoOakv0ypHBpgjgtpa7Nvc3PI+IjB1A==
dependencies:
"@babel/runtime" "^7.16.7"
fs-extra "^11.0.0"
gatsby-core-utils "^4.0.0"
kebab-hash "^0.1.2"
lodash.mergewith "^4.6.2"
webpack-assets-manifest "^5.0.6"

gatsby-plugin-nprogress@^5.13.1:
version "5.13.1"
resolved "https://registry.yarnpkg.com/gatsby-plugin-nprogress/-/gatsby-plugin-nprogress-5.13.1.tgz#f7d402186c090b26fb0cb360ebe1a4f0308dd8a2"
Expand Down Expand Up @@ -8825,6 +8846,13 @@ katex@^0.16.9:
dependencies:
commander "^8.3.0"

kebab-hash@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/kebab-hash/-/kebab-hash-0.1.2.tgz#dfb7949ba34d8e70114ea7d83e266e5e2a4abaac"
integrity sha512-BTZpq3xgISmQmAVzkISy4eUutsUA7s4IEFlCwOBJjvSFOwyR7I+fza+tBc/rzYWK/NrmFHjfU1IhO3lu29Ib/w==
dependencies:
lodash.kebabcase "^4.1.1"

keyv@^4.0.0, keyv@^4.5.3:
version "4.5.4"
resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93"
Expand Down Expand Up @@ -9039,6 +9067,13 @@ lock@^1.1.0:
resolved "https://registry.yarnpkg.com/lock/-/lock-1.1.0.tgz#53157499d1653b136ca66451071fca615703fa55"
integrity sha512-NZQIJJL5Rb9lMJ0Yl1JoVr9GSdo4HTPsUEWsSFzB8dE8DSoiLCVavWZPi7Rnlv/o73u6I24S/XYc/NmG4l8EKA==

lockfile@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/lockfile/-/lockfile-1.0.4.tgz#07f819d25ae48f87e538e6578b6964a4981a5609"
integrity sha512-cvbTwETRfsFh4nHsL1eGWapU1XFi5Ot9E85sWAwia7Y7EgB7vfqcZhTKZ+l7hCGxSPoushMv5GKhT5PdLv03WA==
dependencies:
signal-exit "^3.0.2"

lodash-webpack-plugin@^0.11.6:
version "0.11.6"
resolved "https://registry.yarnpkg.com/lodash-webpack-plugin/-/lodash-webpack-plugin-0.11.6.tgz#8204c6b78beb62ce5211217dfe783c21557ecd33"
Expand Down Expand Up @@ -9081,6 +9116,21 @@ lodash.foreach@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.foreach/-/lodash.foreach-4.5.0.tgz#1a6a35eace401280c7f06dddec35165ab27e3e53"
integrity sha512-aEXTF4d+m05rVOAUG3z4vZZ4xVexLKZGF0lIxuHZ1Hplpk/3B6Z1+/ICICYRLm7c41Z2xiejbkCkJoTlypoXhQ==

lodash.get@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
integrity sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==

lodash.has@^4.5.2:
version "4.5.2"
resolved "https://registry.yarnpkg.com/lodash.has/-/lodash.has-4.5.2.tgz#d19f4dc1095058cccbe2b0cdf4ee0fe4aa37c862"
integrity sha512-rnYUdIo6xRCJnQmbVFEwcxF144erlD+M3YcJUVesflU9paQaE8p+fJDcIQrlMYbxoANFL+AB9hZrzSBBk5PL+g==

lodash.kebabcase@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36"
integrity sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==

lodash.map@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.map/-/lodash.map-4.6.0.tgz#771ec7839e3473d9c4cde28b19394c3562f4f6d3"
Expand All @@ -9101,6 +9151,11 @@ lodash.merge@^4.6.2:
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==

lodash.mergewith@^4.6.2:
version "4.6.2"
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55"
integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==

lodash.template@^4.4.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab"
Expand Down Expand Up @@ -13050,7 +13105,7 @@ schema-utils@^2.6.5, schema-utils@^2.7.0:
ajv "^6.12.4"
ajv-keywords "^3.5.2"

schema-utils@^3.0.0, schema-utils@^3.1.1, schema-utils@^3.2.0:
schema-utils@^3.0.0, schema-utils@^3.1.1, schema-utils@^3.2.0, schema-utils@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe"
integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==
Expand Down Expand Up @@ -13862,7 +13917,7 @@ tapable@^1.0.0:
resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==

tapable@^2.1.1, tapable@^2.2.0:
tapable@^2.1.1, tapable@^2.2.0, tapable@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==
Expand Down Expand Up @@ -14860,6 +14915,19 @@ webidl-conversions@^3.0.0:
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==

webpack-assets-manifest@^5.0.6:
version "5.2.1"
resolved "https://registry.yarnpkg.com/webpack-assets-manifest/-/webpack-assets-manifest-5.2.1.tgz#7ebe4c882efdc343029ed2f54a6f7ce990406f08"
integrity sha512-MsEcXVio1GY6R+b4dVfTHIDMB0RB90KajQG8neRbH92vE2S1ClGw9mNa9NPlratYBvZOhExmN0qqMNFTaCTuIg==
dependencies:
chalk "^4.1.2"
deepmerge "^4.3.1"
lockfile "^1.0.4"
lodash.get "^4.4.2"
lodash.has "^4.5.2"
schema-utils "^3.3.0"
tapable "^2.2.1"

webpack-dev-middleware@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-4.3.0.tgz#179cc40795882cae510b1aa7f3710cbe93c9333e"
Expand Down

0 comments on commit dbfad04

Please sign in to comment.