From b8ce0730110f26b9cfa255333a8ddd97326fd1e8 Mon Sep 17 00:00:00 2001 From: Aaron Chacko <143901525+Aaron-Chacko@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:08:48 +0530 Subject: [PATCH] Update prop types for comment for improved structure Enhanced the comment prop validation with PropTypes.shape instead of PropTypes.object for improved, clearer structure. Provides a more explicit structure for the expected shape of the object, improving code readability and maintainability. --- app/javascript/components/Comment.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/javascript/components/Comment.js b/app/javascript/components/Comment.js index dc1a2084c4..15761c843a 100644 --- a/app/javascript/components/Comment.js +++ b/app/javascript/components/Comment.js @@ -92,7 +92,16 @@ Comment.propTypes = { PropTypes.array, PropTypes.element ]), - comment: PropTypes.object.isRequired, + comment: PropTypes.shape({ + authorId: PropTypes.number.isRequired, + authorPicUrl: PropTypes.string, + authorPicFilename: PropTypes.string, + authorUsername: PropTypes.string.isRequired, + commentId: PropTypes.number.isRequired, + commentName: PropTypes.string, + htmlCommentText: PropTypes.string.isRequired, + timeCreatedString: PropTypes.string.isRequired +}).isRequired, deleteButton: PropTypes.element.isRequired, editCommentForm: PropTypes.element.isRequired, isEditFormVisible: PropTypes.bool.isRequired,