Skip to content

Commit 7311d4b

Browse files
committed
Remove cache
1 parent fa44e34 commit 7311d4b

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

web/pages/_app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function MyApp({Component, pageProps}: AppProps<PageProps>) {
5151
useHasLoaded()
5252

5353
useEffect(() => {
54-
console.log('registering service worker...');
54+
console.log('Registering service worker...');
5555
if ('serviceWorker' in navigator) {
5656
navigator.serviceWorker
5757
.register('/service-worker.js')

web/public/service-worker.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
console.log('SW loaded');
22

3-
const CACHE_NAME = 'compass-cache-v1';
3+
// const CACHE_NAME = 'compass-cache-v1';
44

55
self.addEventListener('install', (event) => {
66
console.log('SW installing…');
@@ -12,26 +12,26 @@ self.addEventListener('activate', (event) => {
1212
});
1313

1414
self.addEventListener('fetch', (event) => {
15-
const url = new URL(event.request.url);
16-
17-
// Ignore Next.js dev HMR and static chunks
18-
if (url.pathname.startsWith('/_next/') || url.pathname.startsWith('/__next/')) {
19-
return;
20-
}
21-
22-
event.respondWith(
23-
caches.match(event.request).then((cachedResponse) => {
24-
if (cachedResponse) return cachedResponse;
25-
26-
return fetch(event.request).then((networkResponse) => {
27-
return caches.open(CACHE_NAME).then((cache) => {
28-
// Only cache GET requests to same-origin
29-
if (event.request.method === 'GET' && event.request.url.startsWith(self.location.origin)) {
30-
cache.put(event.request, networkResponse.clone());
31-
}
32-
return networkResponse;
33-
});
34-
});
35-
})
36-
);
15+
// const url = new URL(event.request.url);
16+
//
17+
// // Ignore Next.js dev HMR and static chunks
18+
// if (url.pathname.startsWith('/_next/') || url.pathname.startsWith('/__next/')) {
19+
// return;
20+
// }
21+
//
22+
// event.respondWith(
23+
// caches.match(event.request).then((cachedResponse) => {
24+
// if (cachedResponse) return cachedResponse;
25+
//
26+
// return fetch(event.request).then((networkResponse) => {
27+
// return caches.open(CACHE_NAME).then((cache) => {
28+
// // Only cache GET requests to same-origin
29+
// if (event.request.method === 'GET' && event.request.url.startsWith(self.location.origin)) {
30+
// cache.put(event.request, networkResponse.clone());
31+
// }
32+
// return networkResponse;
33+
// });
34+
// });
35+
// })
36+
// );
3737
});

0 commit comments

Comments
 (0)