-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WorkBox does not perform update method #1186
Labels
Comments
I do not know if it was the right solution, but I managed to circumvent it. I put the workbox to skip the wait, in module.exports = {
lintOnSave: false,
pwa: {
workboxPluginMode: 'GenerateSW',
workboxOptions: {
skipWaiting: true
}
}
} And in /* eslint-disable no-console */
const updated = () => {
console.log('Has new content!')
// use window.location.reload(true) to get new cache
}
const register = async (path) => {
const registration = await navigator.serviceWorker.register(path)
console.log('SW registred!')
const cacheList = await caches.keys()
cacheList.forEach(async (cacheName) => {
if (!cacheName.includes('-temp')) return
const tempCache = await caches.open(cacheName)
const tempCachesKeys = await tempCache.keys()
if (tempCachesKeys.length > 0) {
updated()
}
})
registration.onupdatefound = () => updated()
}
const { NODE_ENV, BASE_URL } = process.env
if (NODE_ENV === 'production') {
if ('serviceWorker' in navigator) {
register(`${BASE_URL}service-worker.js`)
}
} |
This was referenced Apr 13, 2021
This was referenced Apr 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
3.0.0-beta.6
Steps to reproduce
Phases:
Run
vue create app
and select PWA.Run
yarn build
andserve ./dist
to test the site in production.After accessing the site and waiting for the cache to be done, disable the internet and check for offline access.
Edit the
App.vue
by putting some more content.Run
yarn build
andserve ./dist
to test the production site again.What is expected?
The workbox message is expected: New content is available; please refresh.
What is actually happening?
The message is not displayed, so the workbox is not detecting that the content of the application has been updated.
I've already checked that the service worker is in the cache and is not.
The text was updated successfully, but these errors were encountered: