🐛 Fixed reply form showing parent comment author's details#29
Conversation
ref https://linear.app/ghost/issue/BER-3212 When a user opened a reply form, the form header was showing the parent comment author's name and expertise instead of the current user's data. This happened because the code used a fallback pattern that pulled from the comment being replied to when the current member had no value set.
Code Review by Qodo
1. openForm undefined access
|
| let openStyles = ''; | ||
| if (isOpen) { | ||
| const isReplyToReply = !!openForm?.in_reply_to_snippet; | ||
| const isReplyToReply = !!openForm.in_reply_to_snippet; |
There was a problem hiding this comment.
1. openform undefined access 📘 Rule violation ⛯ Reliability
• FormWrapperProps declares openForm as optional, but the new code dereferences it with openForm.in_reply_to_snippet. • If isOpen is true while openForm is undefined, this will throw at runtime and break the reply form UI instead of degrading gracefully.
Agent prompt
## Issue description
`openForm` is typed as optional in `FormWrapperProps`, but the code dereferences it with `openForm.in_reply_to_snippet` after removing optional chaining. This can throw when `openForm` is `undefined`.
## Issue Context
This violates the robustness/edge-case handling requirement because it introduces a potential null/undefined runtime failure.
## Fix Focus Areas
- apps/comments-ui/src/components/content/forms/form.tsx[291-315]સ્ત
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| reply: { | ||
| post_id: postId, | ||
| in_reply_to_id: openForm.in_reply_to_id, | ||
| in_reply_to_id: parent.id, | ||
| status: 'published', | ||
| html | ||
| } |
There was a problem hiding this comment.
2. Reply-to-reply broken 🐞 Bug ✓ Correctness
• ReplyForm now always sends in_reply_to_id: parent.id, which breaks reply-to-reply behavior. • For reply-to-reply, the UI constructs openForm.in_reply_to_id as the specific reply being replied to; losing that changes threading semantics and can break “Reply to …” context/snippet handling.
Agent prompt
### Issue description
`ReplyForm` now always sends `in_reply_to_id: parent.id`, which is wrong for reply-to-reply flows. For nested replies, `openForm.in_reply_to_id` is intentionally set to the specific reply being replied to.
### Issue Context
`openReplyForm` constructs `OpenCommentForm` with `parent_id` (top-level thread) and `in_reply_to_id`/`in_reply_to_snippet` (the specific comment being replied to).
### Fix Focus Areas
- apps/comments-ui/src/components/content/forms/reply-form.tsx[24-36]
- apps/comments-ui/src/components/content/comment.tsx[103-124]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Benchmark PR from agentic-review-benchmarks#2