diff --git a/frontend/src/lib/components/jobs/JobList.svelte b/frontend/src/lib/components/jobs/JobList.svelte index d4a2ad7..92f4712 100644 --- a/frontend/src/lib/components/jobs/JobList.svelte +++ b/frontend/src/lib/components/jobs/JobList.svelte @@ -6,6 +6,7 @@ import { locale, t } from "#lib/i18n/locale.svelte.js"; import type { MessageKey } from "#lib/i18n/messages.js"; import { accounts } from "#lib/stores/accounts.svelte.js"; + import { chats } from "#lib/stores/chats.svelte.js"; import { toasts } from "#lib/stores/toasts.svelte.js"; interface Props { @@ -75,6 +76,9 @@ async function load() { jobs = await listJobs(); + chats.ensureMany( + jobs.map(chatId).filter((id): id is number => id !== null) + ); loading = false; schedule(); } @@ -100,6 +104,10 @@ return typeof value === "number" ? value : null; } + function chatLabel(id: number): string { + return chats.byId(id)?.title ?? t("jobs.chat", { id }); + } + $effect(() => { if (version >= 0 && accounts.selectedId !== null) { load().catch(() => { @@ -141,7 +149,7 @@
{#if chat !== null} - {t("jobs.chat", { id: chat })} + {chatLabel(chat)} {/if} {#if count !== null} diff --git a/frontend/src/lib/components/shares/SharesPanel.svelte b/frontend/src/lib/components/shares/SharesPanel.svelte index c697124..1790697 100644 --- a/frontend/src/lib/components/shares/SharesPanel.svelte +++ b/frontend/src/lib/components/shares/SharesPanel.svelte @@ -29,7 +29,6 @@ let items = $state([]); let loading = $state(false); let filter = $state("active"); - let fetchedAll = $state(false); let expanded = $state(null); let token = 0; @@ -39,9 +38,7 @@ : items ); const activeCount = $derived( - fetchedAll - ? items.filter((item) => shareState(item) === "active").length - : items.length + items.filter((item) => shareState(item) === "active").length ); async function load() { @@ -53,7 +50,6 @@ const rows = await listShares(activeOnly); if (current === token) { items = rows; - fetchedAll = !activeOnly; } } catch { if (current === token) {