Skip to content

Commit 25dd533

Browse files
committed
fix 2
1 parent 6ca14e2 commit 25dd533

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

public/sw.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const GITHUB_API_CACHE = 'github-api-cache-v2';
77
const STATIC_CACHE = 'static-cache-v2';
88
const EXTERNAL_CACHE = 'external-cache-v1';
99
const TOKEN_STORE = 'github-token-store';
10-
const STATIC_ASSETS = ['/', '/index.html', '/sw.js', '/vite.svg', '/src/index.tsx'];
10+
const STATIC_ASSETS = ['/', '/index.html', '/sw.js', '/vite.svg', '/@vite/client', '/src/index.tsx'];
1111

1212
// Install event - cache essential static assets
1313
self.addEventListener('install', (event) => {
@@ -170,7 +170,7 @@ async function handleStaticRequest(request) {
170170
// Handle navigation requests with app shell fallback
171171
async function handleNavigationRequest(request) {
172172
const cache = await caches.open(STATIC_CACHE);
173-
const shell = await cache.match('/index.html');
173+
const shell = await cache.match('/index.html') || await cache.match('/');
174174
if (shell) {
175175
return shell.clone();
176176
}
@@ -187,6 +187,11 @@ async function handleNavigationRequest(request) {
187187
console.warn('Navigation fetch failed:', error);
188188
}
189189

190+
const fallback = await caches.match('/index.html') || await caches.match('/');
191+
if (fallback) {
192+
return fallback.clone();
193+
}
194+
190195
return new Response('Offline - App shell unavailable', {
191196
status: 503,
192197
statusText: 'Service Unavailable'

0 commit comments

Comments
 (0)