diff --git a/package.json b/package.json index 9e05f8e7..d32d76a5 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,6 @@ "@sveltejs/kit": "^2.17.1", "@sveltejs/vite-plugin-svelte": "^4.0.0", "@tailwindcss/container-queries": "^0.1.1", - "@tanstack/svelte-virtual": "^3.8.1", "@types/nprogress": "^0.2.0", "@types/ua-parser-js": "^0.7.39", "autoprefixer": "^10.4.16", diff --git a/src/lib/components/lemmy/comment/CommentListVirtualizer.svelte b/src/lib/components/lemmy/comment/CommentListVirtualizer.svelte index d77b39b7..aafdd93c 100644 --- a/src/lib/components/lemmy/comment/CommentListVirtualizer.svelte +++ b/src/lib/components/lemmy/comment/CommentListVirtualizer.svelte @@ -1,12 +1,9 @@ -
-
+ - {#each items as row, index (row.index)} -
+ {#snippet item(item, index)} +
[nodes[row.index]], (v) => (nodes[row.index] = v[0]) - } + bind:nodes={() => [nodes[index]], (v) => (nodes[index] = v[0])} {post} />
- {/each} -
+ {/snippet} +
diff --git a/src/lib/components/lemmy/post/feed/VirtualFeed.svelte b/src/lib/components/lemmy/post/feed/VirtualFeed.svelte index 4631dea3..35835c70 100644 --- a/src/lib/components/lemmy/post/feed/VirtualFeed.svelte +++ b/src/lib/components/lemmy/post/feed/VirtualFeed.svelte @@ -1,8 +1,5 @@ -
+ {#if !page.url.searchParams.get('noVirtualize')} + + {/if} {#await data.comments.value}
{#each new Array(10) as empty, index} @@ -400,6 +407,7 @@ focus={data.thread.value.focus} onupdate={reloadComments} bind:sort={data.commentSort.value} + virtualize={!page.url.searchParams.get('noVirtualize')} /> {#if comments.comments.length == 0} void focus?: string + virtualize?: boolean } let { @@ -40,6 +42,7 @@ sort = $bindable(), onupdate, focus, + virtualize = true, }: Props = $props() let comments = $state(passedComments) @@ -128,8 +131,16 @@
{/if} - +{#if virtualize} + +{:else} +
+
+ +
+
+{/if}