You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Offline fallback broken, gates on navigator.onLine which lies #64
fetch handler in sw.js only checks cache when navigator.onLine is false. That flag doesn't reliably flip on real disconnects, so the check fails, cache never gets hit, browser shows its native offline page instead of the app.
self.addEventListener('fetch', function (event) {
let online = navigator.onLine
if (!online) {
event.respondWith(caches.match(event.request)...)
}
});
Repro: load once online, kill network, reload.
Fix: try network, catch failure, fall back to cache. Don't bother checking online status at all.
self.addEventListener('fetch', function (event) {
event.respondWith(
fetch(event.request).catch(function () {
return caches.match(event.request).then(res => res || caches.match('index.html'));
})
);
});
Activity
notepad: improve offline behavior courtesy of issue #64
amitmerchant1990 commentedon Aug 6, 2026
Thank you, @drios05
Just updated the strategy based on this issue!