{
+ if (event.target instanceof Element && event.target.closest('[data-opens-settings]')) {
+ event.preventDefault();
+ }
+ }}
>
Section settings
diff --git a/src/lib/components/Sidebar.svelte b/src/lib/components/Sidebar.svelte
index fd2d2e7..1051de1 100644
--- a/src/lib/components/Sidebar.svelte
+++ b/src/lib/components/Sidebar.svelte
@@ -1110,6 +1110,7 @@
{...props}
type="button"
aria-label="Settings for {section.name}"
+ data-opens-settings
onclick={(event) => {
event.stopPropagation();
onOpenSettings(section);
diff --git a/src/lib/history.svelte.ts b/src/lib/history.svelte.ts
index 26e41c3..48a2609 100644
--- a/src/lib/history.svelte.ts
+++ b/src/lib/history.svelte.ts
@@ -97,13 +97,31 @@ class History {
* clicked went nowhere.
*/
viewingId = $state(null);
+ /**
+ * The message of the last list that failed, if `error` still shows it.
+ *
+ * A list that succeeds resolves that error and no other. `refresh` runs
+ * every time the History tab opens, and clearing `error` outright there
+ * wiped a failed body load or clear the moment the tab that reports it was
+ * opened.
+ */
+ #listError: string | null = null;
+
+ #listed(): void {
+ if (this.error !== null && this.error === this.#listError) this.error = null;
+ this.#listError = null;
+ }
+
+ #listFailed(error: unknown): void {
+ this.error = this.#listError = String(error);
+ }
async load(): Promise {
try {
this.entries = (await historyList()).map(fromRecord);
- this.error = null;
+ this.#listed();
} catch (error) {
- this.error = String(error);
+ this.#listFailed(error);
}
}
@@ -123,9 +141,9 @@ class History {
let records: HistoryRecord[];
try {
records = await historyList();
- this.error = null;
+ this.#listed();
} catch (error) {
- this.error = String(error);
+ this.#listFailed(error);
return;
}
const known = new Set(this.entries.map((entry) => entry.id));