-
Notifications
You must be signed in to change notification settings - Fork 4.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
Block Library: Add the Comments Pagination Previous block #36912
Conversation
Size Change: +98 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
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.
It looks good so far. Let's see how it integrates with the parent block after necessary changes get applied.
packages/block-library/src/comments-pagination-previous/edit.js
Outdated
Show resolved
Hide resolved
packages/block-library/src/comments-pagination-previous/index.php
Outdated
Show resolved
Hide resolved
a54a6ae
to
bf2215a
Compare
@c4rl0sbr4v0, do you plan to refresh this PR or do you want until the Comments Pagination Next block #36562 lands? |
I prefer to land first the "Next Block". As after that we will have to update the parent one with all the blocks. |
bf2215a
to
c86f87d
Compare
90f21bc
to
a3e9197
Compare
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.
Great work. It's very similar to the Comments Next Page block. I left some thoughts that aren't blockers. You will have to run npm run docs:build
to trigger documentation update for the list of core blocks page.
A more general note is that the current implementation for all Comments Query Loop blocks is tied to the single post template and highly depends on the presence of the post object. It's okay for now, but we should also look into making it flexible enough to support other use cases where users want to see any list of comments – basically whatever WP_Comment_Query
can process.
packages/block-library/src/comments-pagination-previous/edit.js
Outdated
Show resolved
Hide resolved
packages/block-library/src/comments-pagination-previous/block.json
Outdated
Show resolved
Hide resolved
a3e9197
to
950a9b8
Compare
The failing e2e tests for the Navigation block seem to be unrelated to this PR. Let's re-run the tests again. |
Testing this PR is very complex so I recorded a screencast with voice where I explain all my findings: Screen.Recording.2021-12-21.at.14.54.26.movSome highlights:
Everythin worked as intended when using global discussion settings. |
Thanks for reviewing the entire comments template, is being quite a tricky component at the end! This PR is just for the Previous Block; maybe we could land it and attend those highlights in different issues. I will be glad to create and work on them.
It seems that a similar issue has been merged for the Query Loop. We can create a PR to fix it.
Previous Comments is using a different function to retreive the link. This could be a starting point to fix this issue.
I think that is due to these functions: From my point of view, as a user, it is easier to navigate between newer or older comments than to Next or Previous. But also, this is tied to a sort by date option. If the user wants to sort by most popular or other different than a date, that approach won't work. However, it could be solved just by changing the label, which is editable. I think it would be better first to be able to choose sort order of comments with #37297. That way, we can update the labels to Older or Previous depending on the selection. |
@c4rl0sbr4v0, it all sounds like a great plan. Let’s follow all the steps and land this PR and #37297 before we work on the listed items. |
483e9ae
to
38b9ecb
Compare
Description
We are adding the Previous Comments block for FSE with this PR. It will close #35009 once is done.
We still need to work on how the entire pagination system is displayed with comments accordingly. But will be done in follow-up PRs.
This is just adding styles to the markup and using
get_previous_comments_link()
function in PHP for the server rendering.How has this been tested?
Comment Template
is loading the correct comment/s.Screenshots
Editor:
Frontend:
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).