close
Skip to content

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

Closed
rinkalpagdar wants to merge 2 commits intoWordPress:trunkfrom
rinkalpagdar:starter-content-category
Closed

Wrong initial pattern category selected by default -- Fix#68801
rinkalpagdar wants to merge 2 commits intoWordPress:trunkfrom
rinkalpagdar:starter-content-category

Conversation

@rinkalpagdar
Copy link
Copy Markdown
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

@github-actions
Copy link
Copy Markdown

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 <rinkalpagdar@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

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

@carolinan
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

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

@Mamaduka
Copy link
Copy Markdown
Member

Mamaduka commented Mar 2, 2025

Closing this. The original feature was reverted.

@Mamaduka Mamaduka closed this Mar 2, 2025
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