From 4e6030f3c24ca4e4ee3a758e7ced1bb2e4a6ef46 Mon Sep 17 00:00:00 2001 From: Agent Date: Mon, 24 Aug 2026 18:22:46 -0400 Subject: [PATCH] fix: guard deleteAlert and publishAlert against undefined relay NOTIFIER_RELAY is string | undefined after the earlier guard fix. deleteAlert and publishAlert passed it directly to publish() which expects string[]. Add early-return guards to both functions. Fixes the 2 new TS2322 errors introduced by the previous commit. --- web/src/main.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/src/main.ts b/web/src/main.ts index a7cad80..85ae4c8 100644 --- a/web/src/main.ts +++ b/web/src/main.ts @@ -144,6 +144,8 @@ const loadAlerts = async () => { } const deleteAlert = async (alert: Alert) => { + if (!NOTIFIER_RELAY) return + if (confirm("Are you sure you want to delete this alert?")) { state.update(assoc('alertsLoading', true)) @@ -207,8 +209,11 @@ export const makeAlert = async ({freq, time, email, feeds, secret}: AlertParams) ) } -export const publishAlert = async (params: AlertParams) => - publish({event: await makeAlert(params), relays: [NOTIFIER_RELAY]}) +export const publishAlert = async (params: AlertParams) => { + if (!NOTIFIER_RELAY) return + + await publish({event: await makeAlert(params), relays: [NOTIFIER_RELAY]}) +} // Components