Skip to content

Commit 5a6e50f

Browse files
committed
fix: adjust formatting in CommentItem component for consistency
1 parent 983ae20 commit 5a6e50f

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/backend/persistence/sql-functions/get_comments.sql

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66

77

88
CREATE OR REPLACE FUNCTION public.get_comments(
9-
p_resource_id uuid,
10-
p_resource_type character varying,
11-
p_parent_id uuid DEFAULT NULL::uuid,
12-
p_current_level integer DEFAULT 0
9+
p_resource_id uuid,
10+
p_resource_type character varying,
11+
p_parent_id uuid DEFAULT NULL::uuid,
12+
p_current_level integer DEFAULT 0
1313
)
1414
RETURNS json
1515
LANGUAGE plpgsql
16-
1716
AS $function$
1817
DECLARE
1918
result JSON;
@@ -35,7 +34,7 @@ BEGIN
3534
'username', u.username
3635
),
3736
'replies', get_comments(p_resource_id, p_resource_type, c.id, 1)
38-
) ORDER BY c.created_at
37+
) ORDER BY c.created_at DESC -- Changed to DESC
3938
) INTO result
4039
FROM comments c
4140
JOIN users u ON c.user_id = u.id
@@ -62,7 +61,7 @@ BEGIN
6261
'username', u.username
6362
),
6463
'replies', get_comments(p_resource_id, p_resource_type, c.id, p_current_level + 1)
65-
) ORDER BY c.created_at
64+
) ORDER BY c.created_at DESC -- Changed to DESC
6665
) INTO result
6766
FROM comments c
6867
JOIN users u ON c.user_id = u.id
@@ -72,4 +71,4 @@ BEGIN
7271

7372
RETURN COALESCE(result, '[]'::json);
7473
END;
75-
$function$
74+
$function$

src/components/comment-section.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ const CommentEditor = (props: {
165165
const CommentItem = (props: { comment: CommentPresentation }) => {
166166
return (
167167
<div>
168-
<pre className=" font-normal">{props.comment.body}</pre>
168+
<pre className="font-normal">{props.comment.body}</pre>
169169

170170
{props.comment.replies?.map((c) => <CommentItem comment={c} />)}
171171
</div>

0 commit comments

Comments
 (0)