perf: improve initial virtual list render speed by calculating height once
This commit is contained in:
4 files changed
+57
-29
No files matched your search
+15
-12
@@ -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: [
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user