From a8b65750ca1f7c7d6069fb3781358aaa6fa7426c Mon Sep 17 00:00:00 2001 From: Xylight <80978739+Xyphyn@users.noreply.github.com> Date: Wed, 25 Jun 2025 19:00:06 +0000 Subject: [PATCH] impr: improve virtual list performance and reliability (#595) * fix: sometimes missing posts when navigating backl * impr: debounce updates for resize operations * fix: sentient comments --- eslint.config.js | 1 + .../components/lemmy/comment/Comment.svelte | 12 +---- .../comment/CommentListVirtualizer.svelte | 3 +- .../components/lemmy/comment/Comments.svelte | 2 +- src/lib/components/render/VirtualList.svelte | 46 +++++++++++++------ 5 files changed, 38 insertions(+), 26 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 5e5ff65e..fd8ed3c7 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -27,6 +27,7 @@ export default ts.config( '@typescript-eslint/no-unsafe-function-type': 'warn', 'svelte/require-each-key': 'off', 'svelte/prefer-writable-derived': 'warn', + 'no-console': 'warn', }, }, { diff --git a/src/lib/components/lemmy/comment/Comment.svelte b/src/lib/components/lemmy/comment/Comment.svelte index fbc66b33..5f6ed4d9 100644 --- a/src/lib/components/lemmy/comment/Comment.svelte +++ b/src/lib/components/lemmy/comment/Comment.svelte @@ -38,11 +38,11 @@ actions = true, meta = true, replying = $bindable(false), + open = $bindable(), contentClass = '', class: clazz = '', metaSuffix, children, - open = $bindable(true), }: Props = $props() let editing = $state(false) @@ -74,16 +74,6 @@ editingLoad = false } - - $effect(() => { - if (!open) { - // const - } - }) - - setTimeout(() => { - open = true - }, 500) {#if editing} diff --git a/src/lib/components/lemmy/comment/CommentListVirtualizer.svelte b/src/lib/components/lemmy/comment/CommentListVirtualizer.svelte index 527a4fe6..8232fea5 100644 --- a/src/lib/components/lemmy/comment/CommentListVirtualizer.svelte +++ b/src/lib/components/lemmy/comment/CommentListVirtualizer.svelte @@ -42,7 +42,8 @@ {#if offsetEl} diff --git a/src/lib/components/lemmy/comment/Comments.svelte b/src/lib/components/lemmy/comment/Comments.svelte index 160f9e0a..a989b4f6 100644 --- a/src/lib/components/lemmy/comment/Comments.svelte +++ b/src/lib/components/lemmy/comment/Comments.svelte @@ -111,7 +111,7 @@ node.comment_view.counts.child_count > 0 ? 'border-l' : ''} ml-2.5 border-slate-200 dark:border-zinc-800 pl-2.5" - bind:open={() => node.expanded, value => (node.expanded = value)} + bind:open={nodes[index].expanded} > {#if node.children?.length > 0} diff --git a/src/lib/components/render/VirtualList.svelte b/src/lib/components/render/VirtualList.svelte index 72c41025..7148f850 100644 --- a/src/lib/components/render/VirtualList.svelte +++ b/src/lib/components/render/VirtualList.svelte @@ -1,8 +1,9 @@ - -