From 8fae3aa89a5448649d2d1a5dbfc70140379d2b18 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 21 Jan 2026 16:49:33 -0500 Subject: [PATCH] Fix(ServiceWorker): Mitigate persistent TypeError by disabling auto-registration - Mitigation: Disabled `serviceWorker.register` in `svelte.config.js` to stop the loop of `TypeError` during script evaluation. - Debug Tool: Preserved the `fix-sw` cache clearing utility by moving it to `src/routes/testing/fix-sw/+page.svelte` for future investigation. - Service Worker: Simplified `src/service-worker.js` to a minimal "Hello World" state and removed the problematic `.ts` version. - Cleanup: Minor formatting adjustment in `ae_events_functions.ts`. - Docs: Updated `TODO.md` and `GEMINI.md` to reflect the mitigation and planned follow-up. --- GEMINI.md | 1 + TODO.md | 5 +- src/lib/ae_events_functions.ts | 3 +- src/routes/testing/fix-sw/+page.svelte | 71 +++++++++++++++++++++++ src/service-worker.js | 78 +++----------------------- svelte.config.js | 3 + 6 files changed, 87 insertions(+), 74 deletions(-) create mode 100644 src/routes/testing/fix-sw/+page.svelte diff --git a/GEMINI.md b/GEMINI.md index 52857bde..88c01ed7 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -68,6 +68,7 @@ This project is the frontend UI/UX for the Aether (AE) system, built with Svelte - **V3 API Hardening:** Updated `search_ae_obj_v3` to correctly serialize all object-type `params` into the URL, enabling complex filtering like `ft_qry`. - **Event Session Search:** Restored full business logic mapping for session search, including `ft_qry`, `lk_qry`, and `and_qry`. - **Service Worker:** Fixed 404 on `/manifest.json` path in `app.html` and restored `service-worker.js` to standard SvelteKit state to resolve evaluation errors. +- **Service Worker Mitigation:** Disabled automatic service worker registration in `svelte.config.js` to resolve persistent `TypeError` during script evaluation. Moved debugging tool to `src/routes/testing/fix-sw/`. ### Hardening & V3 Stabilization (2026-01-20) - **IDAA Search Hardening:** Isolated IDAA Recovery Meetings to a specialized `qry_ae_obj_li__event_v2` function. Restored full 154-result capacity and implemented "Inclusive OR" location logic (Virtual/In-person). diff --git a/TODO.md b/TODO.md index 95e1d451..da61cf6f 100644 --- a/TODO.md +++ b/TODO.md @@ -12,7 +12,10 @@ This is a list of tasks to be completed before the next event/show/conference. - [ ] **Event Badge Search:** Restore specialized business logic. - [ ] **Exhibit Search:** Restore missing search function and logic. - [ ] **Global Rule:** Preserve `ft_qry`, `lk_qry`, and `and_qry` blocks as "sacred" business logic. Never put non-searchable fields in the POST body. -2. **Service Worker Reliability:** Monitor for `TypeError` after manifest path fix and evaluation hardening. +2. **Service Worker Reliability (Mitigated):** + - [x] **Disable Auto-Registration:** Temporarily disabled `serviceWorker.register` in `svelte.config.js` to stop `TypeError` loop. + - [x] **Fix Tool:** Moved `fix-sw` utility to `/testing/fix-sw` for future debugging. + - [ ] **Root Cause Investigation:** Re-enable SW registration later and debug why the script evaluation fails (likely caching or build artifact issues). 3. **Aether Native V3:** Technical planning complete. Ready to scaffold the new Electron 33+ shell and implement the V3 "Zero-Config" bridge. 4. **Jitsi Module Updates:** Prepare for upcoming demo. Audit `video_conferences/+page.svelte` for UI/UX improvements and stability. diff --git a/src/lib/ae_events_functions.ts b/src/lib/ae_events_functions.ts index 6fe1b4bd..b6c5f81c 100644 --- a/src/lib/ae_events_functions.ts +++ b/src/lib/ae_events_functions.ts @@ -76,8 +76,7 @@ const export_obj = { // Event Files load_ae_obj_id__event_file: event_file.load_ae_obj_id__event_file, load_ae_obj_li__event_file: event_file.load_ae_obj_li__event_file, - create_event_file_obj_from_hosted_file_async: - event_file.create_event_file_obj_from_hosted_file_async, + create_event_file_obj_from_hosted_file_async: event_file.create_event_file_obj_from_hosted_file_async, delete_ae_obj_id__event_file: event_file.delete_ae_obj_id__event_file, update_ae_obj__event_file: event_file.update_ae_obj__event_file, qry__event_file: event_file.qry__event_file, diff --git a/src/routes/testing/fix-sw/+page.svelte b/src/routes/testing/fix-sw/+page.svelte new file mode 100644 index 00000000..9e4a3ffb --- /dev/null +++ b/src/routes/testing/fix-sw/+page.svelte @@ -0,0 +1,71 @@ + + +
+

Service Worker Reset Tool

+

Attempting to unregister all service workers and clear caches to fix the TypeError loop.

+ +
+ {#each status as line} +
{line}
+ {/each} +
+ + +
diff --git a/src/service-worker.js b/src/service-worker.js index f2a54696..763fe804 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -1,77 +1,13 @@ /// -import { build, files, version } from '$service-worker'; +/// -// Create a unique cache name for this deployment -const CACHE = `cache-${version}`; +console.log('Service Worker: Hello from the simplified JS worker!'); -const ASSETS = [ - ...build, // the app itself - ...files // everything in `static` -]; - -self.addEventListener('install', (event) => { - // Create a new cache and add all files to it - async function addFilesToCache() { - const cache = await caches.open(CACHE); - await cache.addAll(ASSETS); - } - - event.waitUntil(addFilesToCache()); +self.addEventListener('install', () => { + console.log('Service Worker: Installed'); + self.skipWaiting(); }); -self.addEventListener('activate', (event) => { - // Delete old caches - async function deleteOldCaches() { - for (const key of await caches.keys()) { - if (key !== CACHE) await caches.delete(key); - } - } - - event.waitUntil(deleteOldCaches()); +self.addEventListener('activate', () => { + console.log('Service Worker: Activated'); }); - -self.addEventListener('fetch', (event) => { - // ignore POST requests etc - if (event.request.method !== 'GET') return; - - async function respond() { - const url = new URL(event.request.url); - const cache = await caches.open(CACHE); - - // `build`/`files` can always be served from the cache - if (ASSETS.includes(url.pathname)) { - const response = await cache.match(url.pathname); - - if (response) { - return response; - } - } - - // for everything else, try the network first, but fallback to the cache if we're offline - try { - const response = await fetch(event.request); - - // if we're offline, fetch can return a value that is not a response - // instead of throwing - check it is a real response - if (response instanceof Response) { - if (response.status === 200) { - cache.put(event.request, response.clone()); - } - return response; - } - throw new Error('invalid response'); - } catch (err) { - const response = await cache.match(event.request); - - if (response) { - return response; - } - - // if there is no match, the throw will propagate to the browser, which - // will show its default offline page. - throw err; - } - } - - event.respondWith(respond()); -}); \ No newline at end of file diff --git a/svelte.config.js b/svelte.config.js index 00d60cd2..c6b0ddd2 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -14,6 +14,9 @@ const config = { inspector: true }, kit: { + serviceWorker: { + register: false + }, adapter: adapter_node() // adapter: adapter_static({