diff --git a/src/components/Diff.svelte b/src/components/Diff.svelte index ac282bf7e..887927d50 100644 --- a/src/components/Diff.svelte +++ b/src/components/Diff.svelte @@ -1,6 +1,9 @@ @@ -192,6 +196,26 @@ }; } } + + let threadExpandedStates: Record = $state( + codeComments + ? Object.fromEntries( + codeComments.threads.map(t => [t.root.id, t.root.resolved]), + ) + : {}, + ); + + $effect(() => { + threadExpandedStates = codeComments + ? Object.fromEntries( + codeComments.threads.map(t => [t.root.id, t.root.resolved]), + ) + : {}; + }); + + function toggleCommentExpand(commentId: string) { + threadExpandedStates[commentId] = !threadExpandedStates[commentId]; + }