Closed annezazu closed 2 years ago
TEST REPORT
Go to WordPress customize page, ensure that the option "Your latest posts" in homepage settings is set.
Open Site Editor.
Add a Post Author block
In the block's setting, change the author from the current to any other author.
notice that in the editor the author's name didn't change accordingly
After some debug it appears that the bug is due to the missing of postType and postId.
introduced here: #19894 (looks like an oversight)
ping @draganescu since he spearheaded this part of code and I am not sure what should be the best way to fix this. Should we disable the block when there's no postId?
I'm open to any suggestion, and then I can ship a patch.
@mauriac the problem you reported seems different from the one in the issue. Changing the author outside of a post has no effect since there is no post to edit. I think that drop-down should not show if there is not post.
Trying to see if it's trivial to bring over the feature the query block has to get post from query.
So the problem here is that when there are no posts, the author block does not get any post id from the context. This is a quirk of how block context works on the server-side, for some reason if there are posts, the contextual post type and post id are set to the 1st one in the list of posts from the query block.
@mauriac the problem you reported seems different from the one in the issue. Changing the author outside of a post has no effect since there is no post to edit. I think that drop-down should not show if there is not post.
I used to think that fix the postId missing will fix this issue, this is due to my first understand of the block purpose; but now I guess you are right. I'll create a new issue related to my problem and I'll probably ship a patch according to your comment ========> I think that drop-down should not show if there is not post.
Description
If you add a Post Author block to the Author template and view the template for an author without any posts yet, the post author block doesn't display. This was found as part of the thirteenth call for testing for the FSE Outreach Program:
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Here's a quick video of me demonstrating the problem: https://user-images.githubusercontent.com/26996883/163894155-98f43d27-0442-45b8-96a7-6fb305ca66b0.mov
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes