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: Allow patterns within patterns to render in Block Preview #40794

Conversation

inc2734
Copy link
Contributor

@inc2734 inc2734 commented May 3, 2022

What?

Return the correct settings.__experimentalBlockPatterns in BlockPreview.

Resolves #39732

Why?

Patterns is not rendered in BlockPreview.

How?

In BlockPreview, settings.__experimentalBlockPatterns was overwritten with [], so that process was removed.

Testing Instructions

  1. Activate TwentyTwentyTwho
  2. Go to "Site Editor"
  3. Click header template part.
  4. Click "Replace" in toolbar.

@inc2734 inc2734 requested a review from ellatrix as a code owner May 3, 2022 15:49
@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label May 3, 2022
@github-actions
Copy link

github-actions bot commented May 3, 2022

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @inc2734! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@Mamaduka Mamaduka changed the title #39732 Fixed a bug that caused settings.__experimentalBlockPatterns to be empty in BlockPreview Patterns: Allow patterns within patterns to render in Block Preview May 5, 2022
@Mamaduka Mamaduka 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 5, 2022
@@ -37,7 +37,6 @@ export function BlockPreview( {
);
const settings = useMemo( () => {
const _settings = { ...originalSettings };
_settings.__experimentalBlockPatterns = [];
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for contributing, @inc2734.

It looks like this was intentionally added to avoid parsing patterns in block previews - #29444 (comment).

Unfortunately, I'm not familiar with this part of the code, so maybe folks who reviewed the original PR can help us out. Cc @mcsf, @ntsekouras

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR @inc2734! @Mamaduka is right about the reasoning for this line of code. We should try to find some different solution here.

@t-hamano
Copy link
Contributor

t-hamano commented Dec 8, 2023

#39732 seems to have been fixed by #44784. Do we want to close this PR?

@ntsekouras ntsekouras closed this Dec 14, 2023
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 First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow patterns within patterns to render in BlockPreview
4 participants