Fix iframe reload and service worker caching

This commit is contained in:
Scott Idem
2026-05-13 15:08:17 -04:00
parent cdcec259f7
commit 82430649db
2 changed files with 8 additions and 10 deletions

View File

@@ -35,9 +35,6 @@ let {
hide_icon = false hide_icon = false
}: Props = $props(); }: Props = $props();
// *** Import Svelte specific
import { goto } from '$app/navigation';
// *** Import other supporting libraries // *** Import other supporting libraries
import { import {
BadgeQuestionMark, BadgeQuestionMark,
@@ -49,13 +46,10 @@ import {
} from '@lucide/svelte'; } from '@lucide/svelte';
// *** Import Aether specific variables and functions // *** Import Aether specific variables and functions
import { import {
ae_snip,
ae_loc, ae_loc,
ae_sess, ae_sess,
ae_api, ae_api,
ae_trig,
slct, slct,
slct_trigger,
type key_val type key_val
} from '$lib/stores/ae_stores'; } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
@@ -488,9 +482,8 @@ class:to-90%={$ae_sess.show_help_tech} -->
localStorage.clear(); localStorage.clear();
sessionStorage.clear(); sessionStorage.clear();
goto('/', { invalidateAll: true }); // Reload the current iframe URL so Novi/query params stay intact.
window.location.reload();
// window.location.reload();
} else { } else {
// Confirm before clearing // Confirm before clearing
if ( if (

View File

@@ -33,6 +33,7 @@ self.addEventListener('activate', (event) => {
self.addEventListener('fetch', (event) => { self.addEventListener('fetch', (event) => {
// ignore POST requests etc // ignore POST requests etc
if (event.request.method !== 'GET') return; if (event.request.method !== 'GET') return;
if (!event.request.url.startsWith('http')) return;
async function respond() { async function respond() {
const url = new URL(event.request.url); const url = new URL(event.request.url);
@@ -49,7 +50,11 @@ self.addEventListener('fetch', (event) => {
const response = await fetch(event.request); const response = await fetch(event.request);
if (response.status === 200) { if (response.status === 200) {
cache.put(event.request, response.clone()); try {
await cache.put(event.request, response.clone());
} catch (err) {
console.warn('Service worker cache put skipped:', err);
}
} }
return response; return response;