fix(sqlite,browser): resolve SQLite connection pool deadlock, disable stale SW cache, and update BRAIN.md
MindSift CI & Docker Release / Build, Test in Container & Push (push) Failing after 38s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Failing after 38s
This commit is contained in:
1 parent
d6bc2976d9
commit
5c4e130862
8 files changed
+414
-231
No files matched your search
+9
-24
@@ -1,33 +1,18 @@
|
||||
const CACHE_NAME = 'mindsift-pwa-v1';
|
||||
const ASSETS = ['/', '/index.html', '/manifest.json'];
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME).then((cache) => cache.addAll(ASSETS))
|
||||
);
|
||||
// Network-first / cache-clearing service worker to ensure fresh builds across all browsers
|
||||
self.addEventListener('install', () => {
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener('activate', (event) => {
|
||||
event.waitUntil(
|
||||
caches.keys().then((keys) =>
|
||||
Promise.all(keys.filter((k) => k !== CACHE_NAME).map((k) => caches.delete(k)))
|
||||
)
|
||||
caches
|
||||
.keys()
|
||||
.then((keys) => Promise.all(keys.map((k) => caches.delete(k))))
|
||||
.then(() => self.clients.claim())
|
||||
);
|
||||
self.clients.claim();
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
if (event.request.method !== 'GET' || event.request.url.includes('/api/')) {
|
||||
return;
|
||||
}
|
||||
event.respondWith(
|
||||
fetch(event.request)
|
||||
.then((res) => {
|
||||
const clone = res.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
|
||||
return res;
|
||||
})
|
||||
.catch(() => caches.match(event.request).then((cached) => cached || caches.match('/')))
|
||||
);
|
||||
self.addEventListener('fetch', () => {
|
||||
// Always use native browser network fetch so API calls and fresh Vite bundles are never intercepted by stale caches
|
||||
return;
|
||||
});
|
||||
Reference in new issue
Block a user