Added new clear IDB tables button to the AE system bar/menu.
This commit is contained in:
@@ -15,7 +15,10 @@
|
|||||||
import {
|
import {
|
||||||
Bug,
|
Bug,
|
||||||
CircleX,
|
CircleX,
|
||||||
|
// DatabaseMinus,
|
||||||
|
// DatabaseX,
|
||||||
Eraser,
|
Eraser,
|
||||||
|
ListX,
|
||||||
Lock,
|
Lock,
|
||||||
// LockKeyhole,
|
// LockKeyhole,
|
||||||
LogOut,
|
LogOut,
|
||||||
@@ -80,8 +83,24 @@ function toggle_theme_mode() {
|
|||||||
// DOM sync (class) is handled reactively in +layout.svelte effect #3
|
// DOM sync (class) is handled reactively in +layout.svelte effect #3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Dev: clear IDB only — preserves localStorage/sessionStorage (auth state, prefs) ──
|
||||||
|
async function handle_clear_idb_only() {
|
||||||
|
if (
|
||||||
|
!confirm(
|
||||||
|
'Clear all IndexedDB databases then reload? localStorage and sessionStorage will be preserved.'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
const db_list = await indexedDB.databases();
|
||||||
|
console.log('[clear_idb] IDB databases found:', db_list.map((d) => d.name));
|
||||||
|
for (const db of db_list) {
|
||||||
|
if (db.name) indexedDB.deleteDatabase(db.name);
|
||||||
|
}
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
// ── Dev: clear all browser storage + all IndexedDB databases, then reload ──
|
// ── Dev: clear all browser storage + all IndexedDB databases, then reload ──
|
||||||
async function handle_clear_storage_db() {
|
async function handle_clear_storage_and_idb() {
|
||||||
if (
|
if (
|
||||||
!confirm(
|
!confirm(
|
||||||
'FULL RESET: Delete ALL IndexedDB databases, clear localStorage and sessionStorage, then reload? This cannot be undone.'
|
'FULL RESET: Delete ALL IndexedDB databases, clear localStorage and sessionStorage, then reload? This cannot be undone.'
|
||||||
@@ -289,6 +308,22 @@ function apply_theme(value: string) {
|
|||||||
<span class="italic opacity-50">Not signed in</span>
|
<span class="italic opacity-50">Not signed in</span>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Button to fully clear *only* the IDB tables. This is mostly to clear up orphan records, but sometimes the table itself needs a reset. -->
|
||||||
|
<!-- Clear IDB only — *preserves* localStorage/sessionStorage -->
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-sm preset-filled-warning-200-800 hover:preset-filled-error-100-900 group/menu transition-all duration-200"
|
||||||
|
onclick={handle_clear_idb_only}
|
||||||
|
title="Clear cached records in the local IndexedDB tables. You will not be signed out. This is safe. This preserves localStorage/sessionStorage.">
|
||||||
|
<!-- <Eraser size="1.1em" /> -->
|
||||||
|
<!-- <DatabaseX size="1.1em" /> -->
|
||||||
|
<ListX size="1.1em" />
|
||||||
|
<span
|
||||||
|
class="btn-label max-w-0 opacity-0 transition-all duration-800 hover:duration-100 group-hover/menu:max-w-24 group-hover/menu:opacity-100"
|
||||||
|
>Clear IDB</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-icon btn-sm preset-filled-tertiary-200-800 hover:preset-filled-error ml-2 shrink-0 transition-all"
|
class="btn btn-icon btn-sm preset-filled-tertiary-200-800 hover:preset-filled-error ml-2 shrink-0 transition-all"
|
||||||
@@ -513,14 +548,14 @@ function apply_theme(value: string) {
|
|||||||
Reload Page
|
Reload Page
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Clear storage + IndexedDB -->
|
<!-- Clear localStorage, sessionStorage, and all IndexedDB databases — full reset -->
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-sm preset-tonal-error w-full justify-end"
|
class="btn btn-sm preset-tonal-error w-full justify-end"
|
||||||
onclick={handle_clear_storage_db}
|
onclick={handle_clear_storage_and_idb}
|
||||||
title="Clear localStorage, sessionStorage, and all IndexedDB tables — then reload">
|
title="Clear all IndexedDB tables only — then reload">
|
||||||
<Eraser size="1em" class="opacity-60" />
|
<Eraser size="1em" class="opacity-60" />
|
||||||
Clear Storage & DB
|
Clear All Storage + IDB
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- URL param builder -->
|
<!-- URL param builder -->
|
||||||
|
|||||||
Reference in New Issue
Block a user