fix: rename bots → telegramBots in targets page to fix undefined reference
The variable was named `bots` but getBotName() referenced `telegramBots`, causing a runtime crash and persistent loading on the targets page.
This commit is contained in:
@@ -62,7 +62,7 @@
|
|||||||
let allTargets = $derived(targetsCache.items);
|
let allTargets = $derived(targetsCache.items);
|
||||||
let activeType = $derived(page.url.searchParams.get('type') as TargetType | null);
|
let activeType = $derived(page.url.searchParams.get('type') as TargetType | null);
|
||||||
let targets = $derived(activeType ? allTargets.filter(t => t.type === activeType) : allTargets);
|
let targets = $derived(activeType ? allTargets.filter(t => t.type === activeType) : allTargets);
|
||||||
let bots = $derived(telegramBotsCache.items);
|
let telegramBots = $derived(telegramBotsCache.items);
|
||||||
let emailBots = $derived(emailBotsCache.items);
|
let emailBots = $derived(emailBotsCache.items);
|
||||||
let matrixBots = $derived(matrixBotsCache.items);
|
let matrixBots = $derived(matrixBotsCache.items);
|
||||||
let botChats = $state<Record<number, TelegramChat[]>>({});
|
let botChats = $state<Record<number, TelegramChat[]>>({});
|
||||||
@@ -237,9 +237,9 @@
|
|||||||
<select id="tgt-bot" bind:value={form.bot_id} onchange={loadBotChats} required
|
<select id="tgt-bot" bind:value={form.bot_id} onchange={loadBotChats} required
|
||||||
class="w-full px-3 py-2 border border-[var(--color-border)] rounded-md text-sm bg-[var(--color-background)]">
|
class="w-full px-3 py-2 border border-[var(--color-border)] rounded-md text-sm bg-[var(--color-background)]">
|
||||||
<option value={0} disabled>— {t('telegramBot.selectBot')} —</option>
|
<option value={0} disabled>— {t('telegramBot.selectBot')} —</option>
|
||||||
{#each bots as bot}<option value={bot.id}>{bot.name} (@{bot.bot_username})</option>{/each}
|
{#each telegramBots as bot}<option value={bot.id}>{bot.name} (@{bot.bot_username})</option>{/each}
|
||||||
</select>
|
</select>
|
||||||
{#if bots.length === 0}
|
{#if telegramBots.length === 0}
|
||||||
<p class="text-xs text-[var(--color-muted-foreground)] mt-1">{t('telegramBot.noBots')} <a href="/telegram-bots" class="underline">→</a></p>
|
<p class="text-xs text-[var(--color-muted-foreground)] mt-1">{t('telegramBot.noBots')} <a href="/telegram-bots" class="underline">→</a></p>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user