From 4e2e9ce98ad89cc3d26e41c60b067123b85d6382 Mon Sep 17 00:00:00 2001 From: tc-imba Date: Wed, 26 Jun 2024 02:30:09 +0800 Subject: [PATCH] fix: cache problem (again) --- example/config.js | 1 + gatsby-theme-academic/gatsby-browser.js | 6 ++++-- gatsby-theme-academic/gatsby-config.mjs | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/example/config.js b/example/config.js index ab9b1019..b354f06a 100644 --- a/example/config.js +++ b/example/config.js @@ -8,6 +8,7 @@ module.exports = { introduction: [ 'You can write one or several paragraphs to introduce yourself here. You can find this introduction in the `config.js` file in the template.', 'In this site, almost everything supports Markdown Syntax. For example, you can add hyperlinks in the introduction such as [fxhsb](https://github.com/Reapor-Yurnero) with\n```markdown\n[fxhsb](https://github.com/Reapor-Yurnero)\n```', + 'Here we try to test whether reloading is enabled when site updated.', ], avatar: 'avatar.png', professions: [ diff --git a/gatsby-theme-academic/gatsby-browser.js b/gatsby-theme-academic/gatsby-browser.js index acdd0431..6d79ae74 100644 --- a/gatsby-theme-academic/gatsby-browser.js +++ b/gatsby-theme-academic/gatsby-browser.js @@ -4,6 +4,8 @@ import { export const wrapPageElement = _wrapPageElement; -export function onServiceWorkerUpdateReady() { - window.location.reload(true); +// trigger an immediate page refresh when an update is found +export const onServiceWorkerUpdateReady = () => { + window.location.reload(); + console.log('update found, reload the page'); }; diff --git a/gatsby-theme-academic/gatsby-config.mjs b/gatsby-theme-academic/gatsby-config.mjs index 25e18268..6a2fe6d6 100644 --- a/gatsby-theme-academic/gatsby-config.mjs +++ b/gatsby-theme-academic/gatsby-config.mjs @@ -90,6 +90,7 @@ const config = ({ background_color: '#304CFD', theme_color: '#304CFD', display: 'standalone', + cache_busting_mode: 'none', icon, // This path is relative to the root of the site. legacy: true, // this will add apple-touch-icon links to . Required for // versions prior to iOS 11.3.