I have a PWA built with ReactJS and I have the NetworkFirst policy handled by Workbox, so when I update the front, the service worker detects a new version and download it in the background and this new version is applied only in two cases: when the browser is closed and opened or after 24 hours, here is the code of my service-worker.
if (typeof importScripts === 'function') {
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.0.0/workbox-sw.js');
/* global workbox */
if (workbox) {
console.log(`Yay! Workbox is loaded 🎉`);
workbox.core.skipWaiting();
workbox.precaching.precacheAndRoute([]); // URLs to precache injected by workbox build
workbox.routing.registerRoute(
new workbox.routing.NavigationRoute(
new workbox.strategies.NetworkFirst({
cacheName: 'PRODUCTION',
})
)
);
} else {
console.log(`Boo! Workbox didn't load 😬`);
}
}
I would like to know if it is posible with this policy, to do a release that makes an instant update and doesn't need to wait till the service-worker do the update at the next day.
Thanks!!