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

Templates: only resolve patterns for REST API endpoints #61757

Merged
merged 2 commits into from
May 29, 2024

Conversation

ellatrix
Copy link
Member

What?

This PR resolves patterns more conservatively in templates. Instead of always resolving all patterns when getting templates, it only resolves them when accessing templates through the REST API endpoints.

Why?

This fixes #61454: people might be relying on filters when rendering templates server side.

How?

For REST API endpoints, these templates were never rendered anyway, they are raw block markup, to be render in the editor. For the endpoints, these filters never ran anyway.

Testing Instructions

Testing Instructions for Keyboard

Screenshots or screencast

@ellatrix ellatrix requested a review from ryelle May 17, 2024 08:28
Copy link

github-actions bot commented May 17, 2024

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: ellatrix <ellatrix@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: joemcgill <joemcgill@git.wordpress.org>
Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: justintadlock <greenshady@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: ryelle <ryelle@git.wordpress.org>

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

@ellatrix ellatrix added [Type] Bug An existing feature does not function as intended [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels May 17, 2024
Copy link

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ lib/compat/wordpress-6.6/class-gutenberg-rest-templates-controller-6-6.php
❔ lib/compat/wordpress-6.6/resolve-patterns.php

Copy link

Flaky tests detected in cdb7dbd.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9163086626
📝 Reported issues:

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@ellatrix ellatrix merged commit d8351e4 into trunk May 29, 2024
63 checks passed
@ellatrix ellatrix deleted the fix/pattern-hooks branch May 29, 2024 09:05
@github-actions github-actions bot added this to the Gutenberg 18.5 milestone May 29, 2024
justintadlock added a commit to x3p0-dev/x3p0-ideas that referenced this pull request Jun 1, 2024
pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Jun 3, 2024
See WordPress/gutenberg#60349.
See WordPress/gutenberg#61757.
See #6673.

Fixes #61228.

Props ellatrix, antonvlasenko.



git-svn-id: https://develop.svn.wordpress.org/trunk@58303 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Jun 3, 2024
github-actions bot pushed a commit to platformsh/wordpress-performance that referenced this pull request Jun 3, 2024
carstingaxion pushed a commit to carstingaxion/gutenberg that referenced this pull request Jun 4, 2024
)

Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: joemcgill <joemcgill@git.wordpress.org>
Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: justintadlock <greenshady@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: ryelle <ryelle@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Bug An existing feature does not function as intended
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Pattern render hooks no longer run
2 participants