-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix: Restrict export pattern action to user patterns #63228
Conversation
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Co-authored-by: Ramon <[email protected]>
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.
LGTM!
Not a blocker, but I think it might be better to use PATTERN_TYPES.user
instead of a hardcoded string.
However, it seems necessary to write @ts-ignore
to avoid type errors in typescript file, like here:
gutenberg/packages/editor/src/dataviews/actions/delete-post.tsx
Lines 14 to 15 in 879cdc5
// @ts-ignore | |
import { privateApis as patternsPrivateApis } from '@wordpress/patterns'; |
Co-authored-by: ntsekouras <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: t-hamano <[email protected]>
Co-authored-by: ntsekouras <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: t-hamano <[email protected]>
What?
According to this issue: #61787 the
export pattern
action is not meant to be for theme patterns. With a recent refactoring of that action this regressed and we ended up with showing this action in theme patterns, which also caused other issues of not exporting properly(#63217).I think the solution is to add back the check about the
wp_block
(theme patterns havetype===pattern
). This makes it a bit confusing though with our API for registering actions, which right now isregisterEntityAction( 'postType', 'wp_block', exportPattern );
.We should look into the
type===pattern
and where/why is needed..Testing Instructions