diff --git a/example/config.js b/example/config.js index cca921d7..07b0ebb6 100644 --- a/example/config.js +++ b/example/config.js @@ -8,7 +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 (2).', + 'Here we try to test whether reloading is enabled when site updated (3).', ], avatar: 'avatar.png', professions: [ diff --git a/gatsby-theme-academic/gatsby-browser.mjs b/gatsby-theme-academic/gatsby-browser.js similarity index 71% rename from gatsby-theme-academic/gatsby-browser.mjs rename to gatsby-theme-academic/gatsby-browser.js index a629fd1b..35cb970f 100644 --- a/gatsby-theme-academic/gatsby-browser.mjs +++ b/gatsby-theme-academic/gatsby-browser.js @@ -5,6 +5,11 @@ import { export const wrapPageElement = _wrapPageElement; // trigger an immediate page refresh when an update is found +export const onServiceWorkerUpdateFound = () => { + console.log('update found, reload the page'); + window.location.reload(); +}; + export const onServiceWorkerUpdateReady = () => { console.log('update found, reload the page'); window.location.reload(); diff --git a/gatsby-theme-academic/gatsby-ssr.mjs b/gatsby-theme-academic/gatsby-ssr.js similarity index 100% rename from gatsby-theme-academic/gatsby-ssr.mjs rename to gatsby-theme-academic/gatsby-ssr.js