Skip to content

Commit ca2c0e1

Browse files
committed
Adding skipWaiting to see if cache is busted
1 parent 0915483 commit ca2c0e1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/theme/sw.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ importScripts(
22
"https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js"
33
);
44

5+
self.addEventListener("install", event => {
6+
// Take over old service worker immediately, should hopefully fix weird caching issues
7+
self.skipWaiting();
8+
});
9+
510
// https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#stale-while-revalidate
611
// TLDR: If there's a cached version available, use it, but fetch an update for next time.
712
const staleWhileRevalidate = new workbox.strategies.StaleWhileRevalidate();

0 commit comments

Comments
 (0)