Skip to content
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

Query Loop block: remove 'add new post' prompt in the sidebar #67189

Merged
merged 4 commits into from
Nov 26, 2024

Conversation

dhruvang21
Copy link
Contributor

Fixes:- #67177

What?

This PR removes the "Add New Post" link in the Query Loop block's description.

Why?

The "Add New Post" link in the Query Loop block directs users to the post editor. While its intent is to guide users to create posts for an empty Query Loop block, it disrupts the user's workflow by taking them away from the editor. This leads to potential confusion as users may not know how to return and continue working on the Query Loop block. Removing the link ensures a more seamless experience.

How?

The link has been removed from the Query Loop block's description. This adjustment ensures that users are not redirected away from their current editing context.

Testing Instructions

  1. Open a post or page.
  2. Insert a query loop block.
  3. Observe that the "Add New Post" link is no longer present in the block's description.

Screenshots or screencast

image

Copy link

github-actions bot commented Nov 21, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dhruvang21 <dhruvang21@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org>
Co-authored-by: annezazu <annezazu@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@dhruvang21
Copy link
Contributor Author

dhruvang21 commented Nov 21, 2024

I haven’t deleted the create-new-post-link.js file yet, as I believe removing it would require proper documentation or mentioning it in the changelog. I’m not entirely sure of the exact process, so I’d appreciate guidance from the reviewers. Once clarified, I’ll delete the file in the next commit.

@annezazu
Copy link
Contributor

Just tested! Works for me.

@ntsekouras ntsekouras added [Type] Enhancement A suggestion for improvement. [Block] Query Loop Affects the Query Loop Block labels Nov 25, 2024
Copy link
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! If we get the consensus to remove this in the issue, we only need to remove CreateNewPostLink component in this PR and it will be ready to land.

@@ -191,11 +186,6 @@ export default function QueryInspectorControls( props ) {

return (
<>
{ !! postType && (
<BlockInfo>
<CreateNewPostLink postType={ postType } />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as I believe removing it would require proper documentation or mentioning it in the changelog.

We also need to remove this component. It's only used in Query Loop and not exported separately. No need to update anything else, like changelog or doc.

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

In addition to the CreateNewPostLink component, we should be able to remove this style as well.

Another question is whether or not to remove the BlockInfo private slot itself. This slot was introduced in #49819 but is not used except in the Query Loop block.

cc @aaronrobertshaw

Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @dhruvang21 and the ping @t-hamano 👍

I'm definitely on board with removing not only the link but the component and private SlotFill as well.

#49819 was to maintain the existing UI when the block inspector tabs were introduced but it should also provide a loose guide on what needs to removed. As others have noted, this includes:

  • CSS styles for the create new post link
  • CreateNewPostLink component
  • BlockInfo private SlotFill, its use, and private APIs export

The createPrivateSlotFill util was also recently removed.

@ntsekouras
Copy link
Contributor

ntsekouras commented Nov 26, 2024

@dhruvang21 let's also remove the BlockInfo private slot and it would be ready to land. Thank you!

@dhruvang21 dhruvang21 requested a review from ellatrix as a code owner November 26, 2024 09:21
@ntsekouras
Copy link
Contributor

Can you rebase because of the conflicts?

In order to properly remove the BlockInfo slot we need to:

  1. remove the file as you already did
  2. remove the private export here (import and lock)
  3. remove from block inspector (import and usage)

@dhruvang21
Copy link
Contributor Author

Can you rebase because of the conflicts?

In order to properly remove the BlockInfo slot we need to:

  1. remove the file as you already did
  2. remove the private export here (import and lock)
  3. remove from block inspector (import and usage)

Thank you for guiding me! I’ve rebased the branch and resolved the conflict. Please have a look.

Copy link
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@ntsekouras ntsekouras enabled auto-merge (squash) November 26, 2024 10:09
@ntsekouras ntsekouras merged commit 514b670 into WordPress:trunk Nov 26, 2024
62 checks passed
@github-actions github-actions bot added this to the Gutenberg 19.8 milestone Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants