fix: avoid mutating shared arrays in changelog and comments sync

This commit is contained in:
Jun Hyeok Lee 2026-04-01 23:03:52 +09:00
parent b1631cd6f1
commit a42d4d219b
2 changed files with 4 additions and 3 deletions

View file

@ -118,8 +118,9 @@ function transformComments(
for (const [messageId, group] of byMessage) {
const comments: Comment[] = group.topLevel.map((raw) => {
const replies = (group.replies.get(raw.id) || [])
.sort((a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime())
const replies = (group.replies.get(raw.id) ?? []).toSorted(
(a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
)
.map((r) => transformReply(r, memberMap, currentUserId, isOwner));
return {