summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-05-14 00:55:34 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-05-14 00:55:34 -0400
commita38a449ab78a4e8ab56705922f5c13f9365a92a4 (patch)
treeebaca7f7958540518ae6fca0ca2c5a64798c736b
parentae93188f0f4f36086622636ba9ae4810cbd1f8c9 (diff)
Don't try to update last read time for channel pages if the channel has vanished.
This may happen if the user has a link to a channel open when the channel is deleted/expires, or if they return to the app after the last channel they looked at has expired.
-rw-r--r--ui/routes/(app)/ch/[channel]/+page.svelte6
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/routes/(app)/ch/[channel]/+page.svelte b/ui/routes/(app)/ch/[channel]/+page.svelte
index ea8cca6..76bb638 100644
--- a/ui/routes/(app)/ch/[channel]/+page.svelte
+++ b/ui/routes/(app)/ch/[channel]/+page.svelte
@@ -46,8 +46,10 @@
function setLastRead() {
const lastInView = getLastVisibleMessage();
- const at = !!lastInView ? DateTime.fromISO(lastInView.dataset.at) : channel.at;
- session.local.updateLastReadAt(channelId, at);
+ const at = !!lastInView ? DateTime.fromISO(lastInView.dataset.at) : channel?.at;
+ if (!!at) {
+ session.local.updateLastReadAt(channelId, at);
+ }
}
$effect(() => {