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.
This commit is contained in:
@@ -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`.
|
- **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`.
|
- **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:** 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)
|
### 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).
|
- **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).
|
||||||
|
|||||||
5
TODO.md
5
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.
|
- [ ] **Event Badge Search:** Restore specialized business logic.
|
||||||
- [ ] **Exhibit Search:** Restore missing search function and 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.
|
- [ ] **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.
|
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.
|
4. **Jitsi Module Updates:** Prepare for upcoming demo. Audit `video_conferences/+page.svelte` for UI/UX improvements and stability.
|
||||||
|
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ const export_obj = {
|
|||||||
// Event Files
|
// Event Files
|
||||||
load_ae_obj_id__event_file: event_file.load_ae_obj_id__event_file,
|
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,
|
load_ae_obj_li__event_file: event_file.load_ae_obj_li__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,
|
||||||
event_file.create_event_file_obj_from_hosted_file_async,
|
|
||||||
delete_ae_obj_id__event_file: event_file.delete_ae_obj_id__event_file,
|
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,
|
update_ae_obj__event_file: event_file.update_ae_obj__event_file,
|
||||||
qry__event_file: event_file.qry__event_file,
|
qry__event_file: event_file.qry__event_file,
|
||||||
|
|||||||
71
src/routes/testing/fix-sw/+page.svelte
Normal file
71
src/routes/testing/fix-sw/+page.svelte
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<script>
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
|
let status = $state([]);
|
||||||
|
|
||||||
|
function log(msg) {
|
||||||
|
status = [...status, `${new Date().toLocaleTimeString()} - ${msg}`];
|
||||||
|
console.log(`[FIX-SW] ${msg}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function nukeServiceWorkers() {
|
||||||
|
log('Starting Service Worker cleanup...');
|
||||||
|
|
||||||
|
if (!('serviceWorker' in navigator)) {
|
||||||
|
log('Service Workers not supported in this browser.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const registrations = await navigator.serviceWorker.getRegistrations();
|
||||||
|
log(`Found ${registrations.length} registrations.`);
|
||||||
|
|
||||||
|
for (const registration of registrations) {
|
||||||
|
const scope = registration.scope;
|
||||||
|
log(`Unregistering SW at scope: ${scope}`);
|
||||||
|
const success = await registration.unregister();
|
||||||
|
log(`Unregister success: ${success}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (registrations.length === 0) {
|
||||||
|
log('No active Service Workers found.');
|
||||||
|
}
|
||||||
|
|
||||||
|
log('Clearing Cache Storage...');
|
||||||
|
const cacheKeys = await caches.keys();
|
||||||
|
for (const key of cacheKeys) {
|
||||||
|
log(`Deleting cache: ${key}`);
|
||||||
|
await caches.delete(key);
|
||||||
|
}
|
||||||
|
log('Cache storage cleared.');
|
||||||
|
|
||||||
|
log('DONE. Please reload the application now.');
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
log(`ERROR: ${err.message}`);
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
nukeServiceWorkers();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="p-8 max-w-2xl mx-auto font-mono">
|
||||||
|
<h1 class="text-2xl font-bold mb-4 text-red-600">Service Worker Reset Tool</h1>
|
||||||
|
<p class="mb-4">Attempting to unregister all service workers and clear caches to fix the TypeError loop.</p>
|
||||||
|
|
||||||
|
<div class="bg-gray-100 p-4 rounded border border-gray-300 min-h-[200px]">
|
||||||
|
{#each status as line}
|
||||||
|
<div class="border-b border-gray-200 last:border-0 py-1">{line}</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="mt-4 px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700"
|
||||||
|
onclick={() => window.location.reload()}
|
||||||
|
>
|
||||||
|
Reload Page
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
@@ -1,77 +1,13 @@
|
|||||||
/// <reference types="@sveltejs/kit" />
|
/// <reference types="@sveltejs/kit" />
|
||||||
import { build, files, version } from '$service-worker';
|
/// <reference lib="webworker" />
|
||||||
|
|
||||||
// Create a unique cache name for this deployment
|
console.log('Service Worker: Hello from the simplified JS worker!');
|
||||||
const CACHE = `cache-${version}`;
|
|
||||||
|
|
||||||
const ASSETS = [
|
self.addEventListener('install', () => {
|
||||||
...build, // the app itself
|
console.log('Service Worker: Installed');
|
||||||
...files // everything in `static`
|
self.skipWaiting();
|
||||||
];
|
|
||||||
|
|
||||||
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('activate', (event) => {
|
self.addEventListener('activate', () => {
|
||||||
// Delete old caches
|
console.log('Service Worker: Activated');
|
||||||
async function deleteOldCaches() {
|
|
||||||
for (const key of await caches.keys()) {
|
|
||||||
if (key !== CACHE) await caches.delete(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
event.waitUntil(deleteOldCaches());
|
|
||||||
});
|
|
||||||
|
|
||||||
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());
|
|
||||||
});
|
});
|
||||||
@@ -14,6 +14,9 @@ const config = {
|
|||||||
inspector: true
|
inspector: true
|
||||||
},
|
},
|
||||||
kit: {
|
kit: {
|
||||||
|
serviceWorker: {
|
||||||
|
register: false
|
||||||
|
},
|
||||||
adapter: adapter_node()
|
adapter: adapter_node()
|
||||||
|
|
||||||
// adapter: adapter_static({
|
// adapter: adapter_static({
|
||||||
|
|||||||
Reference in New Issue
Block a user