Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter timeline items only including items to show, before passing to VirtualScroll #1381

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions web/src/routes/(app)/TimelineView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
let innerHeight: number;
let scrollY = writable(0);

$: visibleItems = items.filter(
(item) =>
!isMuteEvent(item.event) &&
!$deletedEventIdsByPubkey.get(item.event.pubkey)?.has(item.event.id)
);

onMount(() => {
console.log('Timeline.onMount');
scrollY.subscribe(async (y) => {
Expand Down Expand Up @@ -104,19 +110,15 @@
<svelte:window bind:innerHeight bind:scrollY={$scrollY} />

<section class="card">
<VirtualScroll data={items} key="id" let:data pageMode={true} keeps={50}>
{#if !isMuteEvent(data.event) && !$deletedEventIdsByPubkey
.get(data.event.pubkey)
?.has(data.event.id)}
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
class={canTransition ? 'canTransition-post' : ''}
class:related={$author?.isNotified(data.event)}
on:mouseup={(e) => viewDetail(e, data.event)}
>
<EventComponent item={data} {readonly} {createdAtFormat} {full} />
</div>
{/if}
<VirtualScroll data={visibleItems} key="id" let:data pageMode={true} keeps={50}>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
class={canTransition ? 'canTransition-post' : ''}
class:related={$author?.isNotified(data.event)}
on:mouseup={(e) => viewDetail(e, data.event)}
>
<EventComponent item={data} {readonly} {createdAtFormat} {full} />
</div>
</VirtualScroll>
</section>

Expand Down
Loading