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

[Patterns]: Load theme patterns only in block and site editor #39493

Merged
merged 2 commits into from
Mar 16, 2022

Conversation

ntsekouras
Copy link
Contributor

What?

Load theme patterns only in block and site editor

Why?

From @jsnajdr 's comment:

Downloading and registering current theme patterns is not even limited to the editor pages, but is hooked to the init hook and happens for every page, even site frontend. See #38323

How?

This PR adds checks to fetch/register them only in block and site editor.

@ntsekouras ntsekouras 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 Mar 16, 2022
@ntsekouras ntsekouras requested a review from jsnajdr March 16, 2022 10:38
@ntsekouras ntsekouras self-assigned this Mar 16, 2022
lib/compat/wordpress-6.0/block-patterns.php Outdated Show resolved Hide resolved
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

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

@ntsekouras ntsekouras force-pushed the update/load-theme-patterns-only-when-needed branch from 089a421 to ac9298f Compare March 16, 2022 19:47
@ntsekouras ntsekouras merged commit 7e3ecdc into trunk Mar 16, 2022
@ntsekouras ntsekouras deleted the update/load-theme-patterns-only-when-needed branch March 16, 2022 20:48
@github-actions github-actions bot added this to the Gutenberg 12.9 milestone Mar 16, 2022
@johnstonphilip
Copy link
Contributor

Just a heads up that this seems to break any block patterns that were registered on the current_screen hook.

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
None yet
Development

Successfully merging this pull request may close these issues.

4 participants