Sort of bug fix for version reload. Does it need the alert() to work correctly???

This commit is contained in:
Scott Idem
2025-10-16 21:43:08 -04:00
parent e912c4a48a
commit d1c0148c75
2 changed files with 20 additions and 9 deletions

View File

@@ -5,8 +5,8 @@ import type { Writable } from 'svelte/store';
import type { key_val } from '$lib/ae_stores';
// Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page.
let ver = '2025-10-15_1423';
let ver_idb = '2025-10-15_1423';
let ver = '2025-10-16_2139';
let ver_idb = '2025-10-16_2139';
/* *** BEGIN *** Initialize events_local_data_struct */
// Longer-term app data. This should be stored to *local* storage.

View File

@@ -3,7 +3,8 @@
let log_lvl: number = $state(0);
// *** Import Svelte specific
import { browser } from '$app/environment';
// import { browser } from '$app/environment';
import { goto, invalidateAll } from '$app/navigation';
// *** Import other supporting libraries
// import * as icons from '@lucide/svelte';
@@ -135,7 +136,7 @@ function clear_sess() {
placement="top-center"
> -->
{#if ($events_loc?.ver !== $events_sess?.ver)}
{#if ($events_loc?.ver && $events_loc?.ver !== $events_sess?.ver)}
<div class="fixed inset-0 bg-pink-100/80 z-40">
<button
class="
@@ -145,17 +146,27 @@ function clear_sess() {
border-4 border-warning-300 dark:border-warning-700
transition-all
"
onclick={() => {
onclick={async () => {
// Clear the IndexedDB
clear_idb();
// Clear localStorage and sessionStorage
clear_local();
clear_sess();
// // Clear localStorage and sessionStorage
// clear_local();
// // clear_sess();
// alert('The page will now reload. You may need to sign in again.');
// // location.reload();
// // window.location.reload(true);
// goto('/');
localStorage.clear();
sessionStorage.clear();
alert('The page will now reload. You may need to sign in again.');
await goto('/', {invalidateAll: true});
location.reload();
// window.location.reload(true);
}}
title="A new version of One Sky IT's Aether Events module is available. Click to reload the page and use the latest version."
>