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