From 1a25380ec23f96e5f2c2b8027b49b933c04d90a1 Mon Sep 17 00:00:00 2001 From: yixuan Date: Sun, 5 Jul 2026 11:47:05 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20sort=20by=20newest=20orde?= =?UTF-8?q?r=20focoordinator=20comments=20(#738)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Profile/sections/Comments/common/EntityComments.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Dashboard/Profile/sections/Comments/common/EntityComments.tsx b/src/components/Dashboard/Profile/sections/Comments/common/EntityComments.tsx index 7d929512..1c0a8a67 100644 --- a/src/components/Dashboard/Profile/sections/Comments/common/EntityComments.tsx +++ b/src/components/Dashboard/Profile/sections/Comments/common/EntityComments.tsx @@ -54,7 +54,9 @@ export function EntityComments({ entityId, entityType, comments, testId }: Props const { mutate: deleteComment } = useDeleteComment(entityId, deleteState.deleteCommentId ?? 0, entityType); - const sortedComments = comments.slice().reverse(); + const sortedComments = comments.slice().sort((a, b) => { + return new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime(); + }); const handleAddComment = async () => { if (!newCommentText.trim()) return;