diff --git a/src/components/Notification.svelte b/src/components/Notification.svelte index 09112fa..99524a8 100644 --- a/src/components/Notification.svelte +++ b/src/components/Notification.svelte @@ -16,7 +16,7 @@ {#if notif.eventType === "vote"} - {@const url = notif.meta.url} + {@const url = notif?.meta?.url ?? ''} {@const length = url.length} {@const shortUrl = url.slice(0, 10) + "..." + url.slice(length - 10, length)} {@const finalUrl = length > 24 ? shortUrl : url} @@ -27,11 +27,11 @@ by {#if notif?.senders?.length > 1} {notif?.senders[0].handle} - {#if notif.senders.length - 1 > 0} + {#if notif.senders?.length - 1 > 0} and {notif.senders.length - 1} more {/if} {:else} - {notif.senders[0].handle.length > 12 ? notif.senders[0].handle.slice(0, 12) + "..." : notif.senders[0].handle} + {notif.senders[0].handle?.length > 12 ? notif.senders[0]?.handle?.slice(0, 12) + "..." : notif.senders[0]?.handle ?? ''} {/if}

diff --git a/src/pages/Notifications.svelte b/src/pages/Notifications.svelte index 268263f..5e267b4 100644 --- a/src/pages/Notifications.svelte +++ b/src/pages/Notifications.svelte @@ -51,7 +51,7 @@ const changeNotifsType = async (t : string[] | null) => { {#if loading} -{:else if notifs.length === 0} +{:else if (notifs ?? []).length === 0} {#await pastNotifsPromise}