fix: bypass service worker cache for dynamic /api/ endpoints, resolving stale favorites cache
All checks were successful
Build & Push Docker Image to Gitea Registry / build-and-push (push) Successful in 13s
All checks were successful
Build & Push Docker Image to Gitea Registry / build-and-push (push) Successful in 13s
This commit is contained in:
10
sw.js
10
sw.js
@@ -1,4 +1,4 @@
|
||||
const CACHE_NAME = 'mischlabs-pwa-v25';
|
||||
const CACHE_NAME = 'mischlabs-pwa-v26';
|
||||
const APP_SHELL = [
|
||||
'/',
|
||||
'/index.html',
|
||||
@@ -6,7 +6,7 @@ const APP_SHELL = [
|
||||
'/offline.html',
|
||||
'/style.css?v=33',
|
||||
'/auth.js?v=2',
|
||||
'/app.js?v=39',
|
||||
'/app.js?v=40',
|
||||
'/favorites.js?v=1',
|
||||
'/services.json?v=1',
|
||||
'/manifest.webmanifest?v=4',
|
||||
@@ -41,6 +41,12 @@ self.addEventListener('fetch', (event) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not intercept or cache API requests
|
||||
const url = new URL(request.url);
|
||||
if (url.pathname.startsWith('/api/')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (request.mode === 'navigate') {
|
||||
event.respondWith(
|
||||
fetch(request).catch(() => caches.match('/offline.html'))
|
||||
|
||||
Reference in New Issue
Block a user