diff --git a/src/components/GenericTimelineView.svelte b/src/components/GenericTimelineView.svelte index 3a78b3e..4020b51 100644 --- a/src/components/GenericTimelineView.svelte +++ b/src/components/GenericTimelineView.svelte @@ -50,8 +50,6 @@ let isAtTop = $state(true); let boundaryTime = $state(null); - let virtualList = $state(null); - let scrollToIndex = $state(undefined); const visibleThreads = $derived.by(() => { if (boundaryTime === null) return threads; @@ -62,22 +60,17 @@ timelineId; displayCount = 15; measuredHeights = []; - scrollToIndex = undefined; }); // const renderedThreads = $derived(visibleThreads.slice(0, displayCount)); $effect(() => { - if (threads.length > 0) { - if (isAtTop) boundaryTime = threads[0].newestTime; - else if (boundaryTime === null) boundaryTime = threads[0].newestTime; - } + if (threads.length > 0 && boundaryTime === null) boundaryTime = threads[0].newestTime; }); const showNewPosts = () => { boundaryTime = threads[0]?.newestTime ?? null; - // @ts-ignore - virtualList?.scrollToIndex(0); + window.scrollTo({ top: 0, behavior: 'instant' }); isAtTop = true; }; @@ -194,13 +187,11 @@ {#if isLoggedIn} {#key timelineId} 0 ? scrollToIndex : undefined} > {#snippet item({ index, style }: { index: number; style: string })} {@const thread = renderItem(index)}