Code Review Bench PR #25745 - Redesigned comment moderation list layout#5
Code Review Bench PR #25745 - Redesigned comment moderation list layout#5ketkarameya wants to merge 23 commits intobase_pr_25745_20260125_7021from
Conversation
ref https://linear.app/ghost/issue/FEA-491/design-truncation-and-display-for-long-comments - Longer comments in the comments UI need better truncation and display treatment. The PR clamps the original comment to show max 2 lines and make it possible to view the full comment.
…ests" This reverts commit 10e1f16.
| const [isClamped, setIsClamped] = useState(false) | ||
| const [isExpanded, setIsExpanded] = useState(false) | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
⚠️ Bug: "Show less" button disappears on window resize when expanded
The checkIfClamped resize handler compares scrollHeight > clientHeight on the content div. However, when isExpanded is true, the line-clamp-2 CSS class is removed, so scrollHeight === clientHeight (content is fully visible). On any window resize event, isClamped gets set to false, which hides the ExpandButton — leaving the user stuck in the expanded state with no way to collapse.
The fix is to either:
- Only run the resize check when the content is in its clamped (collapsed) state, or
- Use a ref to track the "naturally clamped" state separately from the expanded state.
Option 1 is simplest — guard the resize handler so it only updates when not expanded:
Was this helpful? React with 👍 / 👎
| useEffect(() => { | |
| useEffect(() => { | |
| const checkIfClamped = () => { | |
| if (contentRef.current && !isExpanded) { | |
| // Only check when content is clamped (line-clamp-2 is active) | |
| setIsClamped(contentRef.current.scrollHeight > contentRef.current.clientHeight); | |
| } | |
| }; | |
| checkIfClamped(); | |
| // Recheck on window resize | |
| window.addEventListener('resize', checkIfClamped); | |
| return () => window.removeEventListener('resize', checkIfClamped); | |
| }, [isExpanded]); |
- Apply suggested fix
| @@ -91,10 +149,6 @@ function CommentsList({ | |||
| const {mutate: deleteComment} = useDeleteComment(); | |||
There was a problem hiding this comment.
⚠️ Bug: Delete comment functionality removed but dead code remains
The "Delete comment" dropdown menu item and its handleDeleteClick handler were removed in this PR, but the following related code remains unreachable:
useDeleteComment()hook (line 149)commentToDelete/setCommentToDeletestate (line 150)confirmDelete()function (lines 152-157)- The entire
AlertDialogfor delete confirmation (lines 366-384)
This is either:
- An unintentional regression — the delete functionality was accidentally removed during the redesign, meaning admins can no longer delete comments from the moderation list.
- Dead code — if the removal was intentional, all the orphaned delete-related code should be cleaned up.
Please clarify intent: if delete should still be available, re-add the menu item in the dropdown. If it was intentionally removed, clean up the dead code.
Was this helpful? React with 👍 / 👎
- Apply suggested fix
There was a problem hiding this comment.
Configure merge blocking · Maintainers can dismiss this review. Gitar never approves changes.
Code Review
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
Benchmark PR for Gitar evaluation
Original PR: agentic-review-benchmarks#4
Redesigns the comment moderation list layout for better UX.
Summary by Gitar
feature_imageto Comment API type and backend serializer inmappers/comments.jsline-clamp-2with "Show more/less" toggle using dynamic DOM measurement (scrollHeightvsclientHeight)CommentContentandExpandButtoncomponents incomments-list.tsx(351 lines changed)This will update automatically on new commits.