mirror of
https://github.com/HeyPuter/puter.git
synced 2026-11-05 13:35:20 +00:00
fix(gui): the service worker never reuses cached imports
The worker is registered with updateViaCache set to none, so the scripts it imports are fetched fresh on every update check.
This commit is contained in:
1 parent
7aa4d91ae9
commit
7e78a4feef
2 files changed
+3
-2
No files matched your search
@@ -157,7 +157,8 @@ export const startPushWorker = async ({
|
||||
dispatchPushTap(event.data.notification);
|
||||
});
|
||||
try {
|
||||
await nav.serviceWorker.register(WORKER_URL, { scope: '/' });
|
||||
// Scripts the worker imports are fetched fresh on each update check.
|
||||
await nav.serviceWorker.register(WORKER_URL, { scope: '/', updateViaCache: 'none' });
|
||||
} catch ( err ) {
|
||||
console.warn('Could not register the service worker:', err);
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ describe('startPushWorker', () => {
|
||||
mod.setPushTapHandler(handler);
|
||||
const nav = makeNav();
|
||||
await start(mod, { nav });
|
||||
expect(nav.serviceWorker.register).toHaveBeenCalledWith('/sw.js', { scope: '/' });
|
||||
expect(nav.serviceWorker.register).toHaveBeenCalledWith('/sw.js', { scope: '/', updateViaCache: 'none' });
|
||||
|
||||
const source = { postMessage: vi.fn() };
|
||||
nav.listeners.message({ data: { type: 'other', notification: { uid: UID } }, source });
|
||||
|
||||
Reference in new issue
Block a user