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

Template parts and synced patterns are undefined and can not be edited In the Site Editor when Gutenberg is active #67443

Closed
3 of 6 tasks
carolinan opened this issue Nov 30, 2024 · 3 comments · Fixed by #67458
Assignees
Labels
[Block] Template Part Affects the Template Parts Block [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@carolinan
Copy link
Contributor

carolinan commented Nov 30, 2024

Description

When I use a block theme, and I have Gutenberg trunk active, (19.8.0-rc.1) template parts are undefined when I select the "Edit" option from the toolbar of the template part block.

Step-by-step reproduction instructions

Activate a block theme.
Activate Gutenberg trunk
Go to Appearance > Editor. Select a template to edit.
Locate or insert any template part in the template.
With the template part selected, locate and click on the "Edit" option in the block toolbar.

Expected result: The template part opens and shows the correct blocks without errors.
Actual result: The editor is blank except for a notification that says the template part may have been deleted.

The url is site-editor.php?p=%2Fwp_template_part%2Fundefined&canvas=edit&focusMode=true
Without Gutenberg active, it is site-editor.php?postId=ollie%2F%2Fheader&postType=wp_template_part&focusMode=true&canvas=edit

I expect the

Screenshots, screen recording, code snippet

template-part.mp4

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@carolinan carolinan added [Type] Bug An existing feature does not function as intended [Block] Template Part Affects the Template Parts Block labels Nov 30, 2024
@carolinan
Copy link
Contributor Author

@youknowriad I believe this is related to #67199.
If I checkout the commit that was made just before this, then there are no issues with editing the template part.

@carolinan carolinan added the [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") label Nov 30, 2024
@carolinan carolinan changed the title Template parts are undefined and can not be edited In the Site Editor when Gutenberg is active Template parts and synced patterns are undefined and can not be edited In the Site Editor when Gutenberg is active Nov 30, 2024
@carolinan
Copy link
Contributor Author

I updated the title only, the same thing happens when you try to edit a synced pattern.
When I select the "Edit original" option in the toolbar, the URL is site-editor.php?p=%2Fwp_block%2Fundefined&canvas=edit&focusMode=true

@carolinan
Copy link
Contributor Author

In the update to onNavigateToEntityRecord, the param is params.id

https://github.com/WordPress/gutenberg/pull/67199/files#diff-824e020152bb3af84d9532be963368df02d0cc4478dea9cd9192d0d8a2a135daR20

But when onNavigateToEntityRecord is used in the template part block and the synced patterns, it is named postId.

https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/block/edit.js#L212
https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/template-part/edit/index.js#L243

If you search the code base for onNavigateToEntityRecord there are a few more occurrences where it is named postId.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Template Part Affects the Template Parts Block [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
2 participants