From 15ee3da76d66b20b668e8d75306365227cf27550 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Fri, 25 Apr 2025 14:37:12 -0400 Subject: [PATCH] Working on annoying version bug fixes. Also trying to make sure the show/hide lock menu works correctly. --- src/lib/ae_stores.ts | 5 ++++- src/routes/+layout.svelte | 28 +++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/lib/ae_stores.ts b/src/lib/ae_stores.ts index 38449e2c..b12346b0 100644 --- a/src/lib/ae_stores.ts +++ b/src/lib/ae_stores.ts @@ -47,7 +47,7 @@ export let ae_snip = string_snippets; // }; // 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-04-18_1335'; +let ver = '2025-04-18_1335'; // KEEP: 2025-04-18_1335 let ver_idb = '2025-04-18_1100'; // Not used // *** BEGIN *** Longer-term app data. This should be stored to local storage. @@ -244,6 +244,9 @@ export let ae_app_local_data_struct: key_val = { test: true, } // console.log(`AE Stores - App Local Storage Data:`, ae_app_local_data_struct); +if (!ae_app_local_data_struct.ver1) { + console.log(`AE Stores - App Local Storage Data:`, ae_app_local_data_struct); +} // This works, but does not uses local storage: // export let ae_loc = writable(ae_app_local_data_struct); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 1cb982b0..2ead6f48 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -111,6 +111,13 @@ if (log_lvl > 1) { console.log(`$slct = `, $slct); } + +// if (!$ae_loc?.app_cfg) { +// $ae_loc.app_cfg = {}; +// $ae_loc.app_cfg.show_element__menu_btn = true; +// $ae_loc.app_cfg.show_element__menu = false; +// } + // // This should only be temporary. || !$ae_loc?.person || !$ae_loc?.user // if (!$ae_loc) { // console.log('No ae_loc. Reloading page...'); @@ -255,21 +262,31 @@ if (browser) { // localStorage.removeItem('ae_idaa_loc'); // localStorage.removeItem('ae_journals_loc'); // localStorage.removeItem('ae_events_loc'); - // localStorage.clear(); + localStorage.clear(); // sessionStorage.removeItem('ae_sess'); // sessionStorage.removeItem('events_sess'); // console.log('Clearing sessionStorage...'); // sessionStorage.clear(); + // try { + // goto(data.route.id, {replaceState: true, invalidateAll: true}); + // } catch (e) { + // console.log('Error going to root page:', e); + // } + // Go to root if not already there. Do this in case things have significantly changed, including routes. We need them to manually click the Reload and Clear Cache button. - console.log('Going to root page...'); - if (data.route.id !== '/') { - goto('/', {replaceState: true, invalidateAll: true}); - } + // console.log('Going to root page...'); + // if (data.route.id !== '/') { + // goto('/', {replaceState: true, invalidateAll: true}); + // } } else if (!$ae_loc?.app_cfg) { console.log('No ae_loc.app_cfg. Reloading page...?'); + $ae_loc.app_cfg = {}; + $ae_loc.app_cfg.show_element__menu_btn = true; + $ae_loc.app_cfg.show_element__menu = false; + // $ae_loc = {}; // localStorage.removeItem('ae_loc'); // localStorage.removeItem('ae_idaa_loc'); @@ -285,6 +302,7 @@ if (browser) { // location.reload(); // tick(); // $ae_loc.app_cfg = {}; + // goto(data.route.id, {replaceState: true, invalidateAll: true}); } else if ($ae_loc?.app_cfg && !$ae_loc?.app_cfg?.show_element__menu_btn) { console.log('No ae_loc.app_cfg.show_element__menu_btn. Forcing show.'); $ae_loc.app_cfg.show_element__menu_btn = true;