fix: scrolling not working for infinite list community pages
This commit is contained in:
1 parent
c3e8fbb6a8
commit
2ba807c5b5
3 files changed
+19
-25
No files matched your search
@@ -59,7 +59,7 @@
|
||||
}
|
||||
|
||||
afterNavigate(() => {
|
||||
$virtualizer.scrollToIndex(lastSeen ?? 0, { align: 'auto' })
|
||||
$virtualizer.scrollToIndex($postFeeds[feedId].lastSeen ?? 0)
|
||||
})
|
||||
|
||||
export let feedData: PostFeed['data']
|
||||
@@ -120,7 +120,7 @@
|
||||
|
||||
if (!id) return
|
||||
|
||||
$postFeeds.main.lastSeen = Number(id)
|
||||
$postFeeds[feedId].lastSeen = Number(id)
|
||||
observer.unobserve(element)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
<div class="flex flex-col gap-3 sm:gap-4 max-w-full w-full min-w-0">
|
||||
<div class="flex flex-col gap-4 max-w-full w-full min-w-0">
|
||||
<EntityHeader
|
||||
banner={community.community.banner}
|
||||
avatar={community.community.icon}
|
||||
@@ -163,9 +163,7 @@
|
||||
</Button>
|
||||
</div>
|
||||
</EntityHeader>
|
||||
<div class="flex flex-row gap-4 max-w-full w-full items-end z-0">
|
||||
<Sort selected={data.sort} />
|
||||
</div>
|
||||
<Sort selected={data.sort} />
|
||||
{#if community.blocked}
|
||||
<Placeholder
|
||||
icon={XMark}
|
||||
@@ -180,10 +178,10 @@
|
||||
{:else}
|
||||
<svelte:component
|
||||
this={browser ? VirtualFeed : PostFeed}
|
||||
posts={data.posts.posts.posts}
|
||||
bind:feedData={data.posts}
|
||||
posts={data.posts.posts}
|
||||
bind:feedData={data}
|
||||
lastSeen={$postFeeds.community.lastSeen}
|
||||
feedId="main"
|
||||
feedId="community"
|
||||
/>
|
||||
{/if}
|
||||
|
||||
@@ -193,7 +191,7 @@
|
||||
>
|
||||
<Pageination
|
||||
page={data.page}
|
||||
cursor={{ next: data.posts.cursor.next }}
|
||||
cursor={{ next: data.cursor.next }}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
on:cursor={(c) => {
|
||||
searchParam($page.url, 'cursor', c.detail)
|
||||
|
||||
@@ -13,19 +13,15 @@ export async function load({ params, fetch, url }) {
|
||||
(url.searchParams.get('sort') as SortType) ||
|
||||
get(userSettings).defaultSort.sort
|
||||
|
||||
return {
|
||||
sort: sort,
|
||||
page: page || 1,
|
||||
posts: await postFeed({
|
||||
id: 'community',
|
||||
url: url,
|
||||
request: {
|
||||
page: page,
|
||||
page_cursor: cursor,
|
||||
sort: sort,
|
||||
limit: 20,
|
||||
community_name: params.name,
|
||||
}
|
||||
}),
|
||||
}
|
||||
return await postFeed({
|
||||
id: 'community',
|
||||
url: url,
|
||||
request: {
|
||||
page: page,
|
||||
page_cursor: cursor,
|
||||
sort: sort,
|
||||
limit: 20,
|
||||
community_name: params.name,
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user