sorted comments by timestamp

This commit is contained in:
plebbitor
2023-03-06 13:33:46 +01:00
parent 356b0739fd
commit 01e06258d9
2 changed files with 5 additions and 2 deletions
+4 -2
View File
@@ -184,10 +184,12 @@ const Thread = ({ setBodyStyle }) => {
} }
return [comment]; return [comment];
}).flat(); }).flat();
return renderedComments;
const sortedComments = renderedComments.sort((a, b) => a.timestamp - b.timestamp);
return sortedComments;
} }
return ( return (
<Container> <Container>
+1
View File
@@ -22,6 +22,7 @@ function renderComments(comments) {
}; };
const renderedComments = comments.flatMap(renderComment); const renderedComments = comments.flatMap(renderComment);
renderedComments.sort((a, b) => a.timestamp - b.timestamp);
return { renderedComments, omittedCount }; return { renderedComments, omittedCount };
} }