-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments: CommentDetail
Redux refactor
#18406
Conversation
|
||
return { | ||
commentIsLiked: get( comment, 'i_like' ), | ||
commentStatus: get( comment, 'status' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little confused on why we pass though ever other prop but these two.
So as an overall comment let's be careful to pick which components are pure UI pieces and which ones are blocks. The former only cares about content display, and things like analytics handlers are passed through to onClick from their parents. With the right props we can render whatever we need. Blocks generally declare their data dependencies, so they are droppable and reusable in any context. If we feel like we're repeating ourselves, that may be an opportunity to create a small block component. I think some of the pain is being caused by the number of props we need off of comment/author. I'd also be open to passing a full comment/author object down a single level, provided we clearly document the shape of the comment that needs to be passed. |
I didn't look at the code, but nice LOC delta |
2cbdcb2
to
6874ecb
Compare
Replaced by full redesign (see #19082). |
CommentDetail
from the devdocs, since it's now completely dependent from theCommentList
.No existing logic has been changed or harmed, this PR really just needs a smoke test on the comments section.
Next task: move
CommentDetail
away from/blocks
and into/my-sites/comment-list
.Another task could be to re-nest some children objects, such as
author
orpost
, that are usually needed in their entirety (or close to that).