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

Wrong initial pattern category selected by default -- Fix #68801

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

rinkalpagdar
Copy link
Contributor

Part of #68736

What?

The default category selection was modified to add a new page.

Why?

The wrong initial pattern category was selected by default while "Add new page"

Testing Instructions

  1. Go to WordPress admin -> pages-> Add new page
  2. Check default category selected is "Starter Content" instead of "All"

Screenshots or screencast

starter-content-default-category

Copy link

github-actions bot commented Jan 21, 2025

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: rinkalpagdar <[email protected]>
Co-authored-by: carolinan <[email protected]>
Co-authored-by: Mamaduka <[email protected]>

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

@carolinan
Copy link
Contributor

The problem with this approach is that now other components can not pass the pattern category as a parameter: it is always set to the starter content.

__experimentalInitialCategory is no longer used.

For example, in the zoom out mode, all categories are supposed to show:
https://github.com/WordPress/gutenberg/blob/trunk/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js#L90

Like I wrote on the issue I was also working on this.

This is what I found out:

Where setInserterIsOpened is used, the category name is a string, while the pattern preview is expecting an object with a name and label parameter.

in the zoom out mode inserter (linked above), the category name is also wrong; the pattern preview is expecting "allPatterns" to show all patterns, not "all"

@rinkalpagdar
Copy link
Contributor Author

Yes Right @carolinan
I was also trying to pass __experimentalInitialCategory parameter to component from inserter > index.js but it was not taking my value because of the string as you said. The selectedPatternCategory was only taking 'allPatterns' value. Any suggestion will be respected. Thanks!

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] Zoom Out labels Jan 22, 2025
@Mamaduka
Copy link
Member

I agree with @carolinan. This shouldn't be resolved by hardcoding the values.

The #68806 seems to be moving in the right direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Zoom Out [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants