// Minimal service worker - no caching to prevent navigation issues
console.log('LocalLendables service worker loaded - caching disabled');

// Skip waiting and activate immediately
self.addEventListener('install', function(event) {
  console.log('Service worker installing - no cache');
  self.skipWaiting();
});

self.addEventListener('activate', function(event) {
  console.log('Service worker activating - clearing any existing cache');
  event.waitUntil(
    caches.keys().then(function(cacheNames) {
      return Promise.all(
        cacheNames.map(function(cacheName) {
          console.log('Deleting cache:', cacheName);
          return caches.delete(cacheName);
        })
      );
    }).then(function() {
      return self.clients.claim();
    })
  );
});

// Pass through all requests without any caching
self.addEventListener('fetch', function(event) {
  event.respondWith(fetch(event.request));
});