Develop#1454
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The request meets the required criteria for approval.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| removeError('name'); | ||
| }} | ||
| /> | ||
|
|
||
| <span className="icon is-small is-left"> | ||
| <i className="fas fa-user" /> |
There was a problem hiding this comment.
Checklist item #11 violation: The delete operation has no error handling. If the delete request fails after the UI already updated, the user won't know and can't retry. Consider adding error handling that restores the comment or shows a notification on failure.
| }) | ||
| .then(() => { | ||
| setBody(''); | ||
| setErrors({}); | ||
| }) |
There was a problem hiding this comment.
Checklist item #11 violation: The catch block silently swallows errors without notifying the user. If adding a comment fails, the user loses their input and doesn't know it failed. Add error handling that allows the user to retry.
| {isSelected ? 'Close' : 'Open'} | ||
| </button> | ||
| </td> | ||
| </tr> |
There was a problem hiding this comment.
This violates checklist item #11: 'Handle Add and Delete errors so the user can retry'. The .catch(() => {}) silently ignores errors, so users cannot know when their comment failed to submit and cannot retry. Add proper error handling here.
| selectedPost: Post | null; | ||
| onSelect: (post: Post | null) => void; | ||
| }; | ||
|
|
||
| export const PostsList: React.FC<Props> = ({ | ||
| posts, |
There was a problem hiding this comment.
This violates checklist item #3: 'make sure you described objects in propTypes'. The users and selectedUser props (both User objects) should have propTypes defined.
| posts: Post[]; | ||
| selectedPost: Post | null; | ||
| onSelect: (post: Post | null) => void; | ||
| }; | ||
|
|
There was a problem hiding this comment.
This violates checklist item #3: 'make sure you described objects in propTypes'. The posts and selectedPost props (both Post objects) should have propTypes defined.
| {canShowCommentsContent && comments.length === 0 && ( | ||
| <p className="title is-4" data-cy="NoCommentsMessage"> | ||
| No comments yet | ||
| </p> |
There was a problem hiding this comment.
Checklist item #11 violation: The .catch(() => {}) block silently swallows errors. Users cannot retry if the comment deletion fails. Consider showing an error state to allow retry.
| )} | ||
|
|
||
| {canShowCommentsContent && !isFormVisible && ( | ||
| <button | ||
| data-cy="WriteCommentButton" | ||
| type="button" | ||
| className="button is-link" |
There was a problem hiding this comment.
Checklist item #11 violation: The delete operation doesn't handle errors. If the API call fails, the optimistic UI update has already removed the comment, but the user is not notified of the failure. Consider adding error handling to allow retry.
|
|
||
| const deleteComment = (commentId: number) => { | ||
| setComments(currentComments => | ||
| currentComments.filter(comment => comment.id !== commentId), | ||
| ); | ||
|
|
||
| client.delete(`/comments/${commentId}`); |
There was a problem hiding this comment.
The deleteComment function performs optimistic deletion but has no error handling. If the API call fails, the user cannot retry or recover the comment. According to checklist item #11, you should handle Delete errors so the user can retry. Consider wrapping the delete call in try/catch and adding error state.
| setPostsLoadingError(true); | ||
| }) | ||
| .finally(() => { | ||
| setIsPostsLoading(false); |
There was a problem hiding this comment.
The catch block for onSubmit is empty - errors are silently swallowed. If adding a comment fails, the user has no indication and cannot retry. Per checklist item #11, handle Add errors so the user can retry.
|
|
||
| type Props = { | ||
| users: User[]; | ||
| selectedUser: User | null; | ||
| onSelect: (user: User) => void; |
There was a problem hiding this comment.
This violates checklist item #3: 'make sure you described objects in propTypes'. While TypeScript types are used, the task specifically requires propTypes. Add propTypes definitions for users, selectedUser, and onSelect using the prop-types package.
No description provided.