Skip to content

Commit ac40cc3

Browse files
committed
Web: Fix focused comment author disappearing
1 parent e38e6f6 commit ac40cc3

File tree

2 files changed

+4
-25
lines changed

2 files changed

+4
-25
lines changed

frontend/apps/web/app/comment-panel.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ export function WebCommentsPanel({
5252

5353
const commentAuthors = useMemo(() => {
5454
if (!focusedCommentId) return comments?.commentAuthors || {}
55-
return focusedComments?.data?.commentAuthors || {}
55+
return {
56+
...(comments?.commentAuthors || {}),
57+
...(focusedComments?.data?.commentAuthors || {}),
58+
}
5659
}, [focusedCommentId, focusedComments, comments])
5760

5861
const parentThread = useMemo(() => {

frontend/packages/shared/src/discussion.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,24 @@ export function getCommentGroups(
1818
})
1919
}
2020
})
21-
console.log(
22-
'getCommentGroups: Initial groups after filtering root comments:',
23-
groups,
24-
)
2521

2622
groups.forEach((group) => {
27-
console.log(`Processing group with id ${group.id}`)
2823
let comment: HMComment | null = group.comments[0]
2924
while (comment) {
3025
const nextComments = comments?.filter(
3126
(c) => c.replyParent === comment?.id,
3227
)
33-
console.log(
34-
`Found ${nextComments?.length || 0} direct replies to comment ${
35-
comment.id
36-
}`,
37-
)
3828

3929
if (nextComments?.length === 1) {
4030
comment = nextComments[0]
4131
group.comments.push(comment)
42-
console.log(
43-
`getCommentGroups: Added comment ${comment.id} to group ${group.id}`,
44-
)
4532
} else {
4633
comment = null
4734
}
4835
}
4936

5037
const lastGroupComment = group.comments.at(-1)
5138
if (!lastGroupComment || !comments) return
52-
console.log(
53-
`getCommentGroups: Finding more comments for lastGroupComment: ${lastGroupComment.id}`,
54-
)
5539

5640
const moreComments = new Set<string>()
5741
let walkMoreCommentIds = new Set<string>([lastGroupComment.id])
@@ -62,18 +46,10 @@ export function getCommentGroups(
6246
.filter((c) => c.replyParent && walkMoreCommentIds.has(c.replyParent))
6347
.map((comment) => comment.id),
6448
)
65-
console.log(
66-
'getCommentGroups: walkMoreCommentIds:',
67-
Array.from(walkMoreCommentIds),
68-
)
6949
}
7050

7151
group.moreCommentsCount = moreComments.size - 1
72-
console.log(
73-
`getCommentGroups: Group ${group.id} moreCommentsCount: ${group.moreCommentsCount}`,
74-
)
7552
})
7653

77-
console.log('Final groups:', groups)
7854
return groups
7955
}

0 commit comments

Comments
 (0)