-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Editor: Fix block context defined for template parts #58807
Conversation
Size Change: +26 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
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.
That makes perfect sense 👍🏻
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @dabowman. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. Core SVNCore Committers: Use this line as a base for the props when committing in SVN:
GitHub Merge commitsIf 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. |
@@ -28,6 +28,12 @@ const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis ); | |||
const { PatternsMenuItems } = unlock( editPatternsPrivateApis ); | |||
|
|||
const noop = () => {}; | |||
const NON_CONTEXTUAL_POST_TYPES = [ |
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.
Would be helpful to explain further what these are or why they are distinct
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.
Follow-up here #58836
closes #58215
Regression introduced in #56000
What?
Using Post Content blocks was causing an error within the template part editor because we were considering that the "postId" defined in the context corresponded to the same template part being rendered and obviously we can't render a template part within itself.
The problem is that we shouldn't be defining the template part's postId as the "post" context being rendered. In fact there are multiple post types who's editor shouldn't define any context: navigation, template part, reusable block and templates These are global entities that are only there to split blocks into logical units but they don't provide a "context" for the current post/page being rendered.
How?
So this PR solve the issue by not providing any "post" context when editing these entities.
Testing instructions