summaryrefslogtreecommitdiff
path: root/ui/routes/(app)
diff options
context:
space:
mode:
Diffstat (limited to 'ui/routes/(app)')
-rw-r--r--ui/routes/(app)/ch/[channel]/+page.svelte17
1 files changed, 9 insertions, 8 deletions
diff --git a/ui/routes/(app)/ch/[channel]/+page.svelte b/ui/routes/(app)/ch/[channel]/+page.svelte
index 7bd0e10..25bc318 100644
--- a/ui/routes/(app)/ch/[channel]/+page.svelte
+++ b/ui/routes/(app)/ch/[channel]/+page.svelte
@@ -22,14 +22,15 @@
}
function getLastVisibleMessage() {
- const parentElement = activeChannel;
- const childElements = parentElement.getElementsByClassName('message');
- const lastInView = Array.from(childElements)
- .reverse()
- .find((el) => {
- return inView(parentElement, el);
- });
- return lastInView;
+ if (activeChannel) {
+ const childElements = activeChannel.getElementsByClassName('message');
+ const lastInView = Array.from(childElements)
+ .reverse()
+ .find((el) => {
+ return inView(activeChannel, el);
+ });
+ return lastInView;
+ }
}
function setLastRead() {