perf: improve initial virtual list render speed by calculating height once

This commit is contained in:
James Xylight committed 2025-07-12 11:35:50 -07:00
1 parent c969a32767
commit 3cd4864748
4 files changed
+57 -29

No files matched your search

+15 -12
View File
@@ -1,5 +1,6 @@
import { t } from '$lib/i18n/translations.js'
import { postFeed } from '$lib/lemmy/postfeed.svelte.js'
import { ReactiveState } from '$lib/promise.svelte.js'
import { settings } from '$lib/settings.svelte'
import type { ListingType, SortType } from 'lemmy-js-client'
import { ChevronDoubleUp } from 'svelte-hero-icons'
@@ -13,18 +14,20 @@ export async function load({ url, fetch }) {
(url.searchParams.get('type') as ListingType) || settings.defaultSort.feed
return {
feed: await postFeed({
id: 'main',
request: {
page_cursor: cursor,
sort: sort,
type_: listingType,
limit: 20,
show_hidden: settings.posts.showHidden,
},
url: url,
fetch: fetch,
}),
feed: new ReactiveState(
await postFeed({
id: 'main',
request: {
page_cursor: cursor,
sort: sort,
type_: listingType,
limit: 20,
show_hidden: settings.posts.showHidden,
},
url: url,
fetch: fetch,
}),
),
contextual: {
actions: [
{