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

[WP 6.1] Block Styles in theme.json do not appear in the Editor or Frontend #44619

Closed
ndiego opened this issue Sep 30, 2022 · 8 comments
Closed
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@ndiego
Copy link
Member

ndiego commented Sep 30, 2022

Description

When Gutenberg is not active, block styles in theme.json are not getting rendered in the Editor or Frontend in WordPress 6.1 Beta 2. Activating Gutenberg solves this, so perhaps something has not been properly ported back to Core.

Also seems like it might be related to: #44434

Step-by-step reproduction instructions

  1. Use WordPress 6.1 Beta 2 and the new TT3 theme
  2. Ensure Gutenberg is not active
  3. Add the sample code to block styles in theme.json (not needed but makes the issue more clear)
  4. Add a new page and add a Code, Group, and Pullquote
  5. See that the custom block styles in theme.json are not applied in both the Editor and Frontend
  6. Now activate Gutenberg and see that everything works correctly
"core/code": {
	"color": {
		"background": "var(--wp--preset--color--secondary)",
		"text": "var(--wp--preset--color--base)"
	},
	"spacing": {
		"padding": {
			"bottom": "var(--wp--preset--spacing--30)",
			"left": "var(--wp--preset--spacing--30)",
			"right": "var(--wp--preset--spacing--30)",
			"top": "var(--wp--preset--spacing--30)"
		}
	},
	"typography": {
		"fontSize": "var(--wp--preset--font-size--small)"
	}
},
"core/group": {
	"color": {
		"background": "var(--wp--preset--color--secondary)",
		"text": "var(--wp--preset--color--base)"
	},
	"spacing": {
		"padding": {
			"bottom": "var(--wp--preset--spacing--30)",
			"left": "var(--wp--preset--spacing--30)",
			"right": "var(--wp--preset--spacing--30)",
			"top": "var(--wp--preset--spacing--30)"
		}
	},
	"typography": {
		"fontSize": "var(--wp--preset--font-size--small)"
	}
},

Screenshots, screen recording, code snippet

Without Gutenberg active:
image

With Gutenberg active:
image

Environment info

  • WordPress 6.1 Beta 2
  • Gutenberg NOT active

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

@ndiego ndiego added [Type] Bug An existing feature does not function as intended [Priority] High Used to indicate top priority items that need quick attention Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Sep 30, 2022
@ndiego ndiego changed the title [WP 6.1] Block Styles in theme.json not appear in the Editor of Frontend [WP 6.1] Block Styles in theme.json do not appear in the Editor of Frontend Sep 30, 2022
@ndiego ndiego changed the title [WP 6.1] Block Styles in theme.json do not appear in the Editor of Frontend [WP 6.1] Block Styles in theme.json do not appear in the Editor or Frontend Sep 30, 2022
@bph
Copy link
Contributor

bph commented Sep 30, 2022

@ndiego I can confirm this bug with a clean installation of the WordPress 6.1 beta 2 version.

@mikachan
Copy link
Member

I can also replicate this with TT3 and another theme called Archeo, using the same test instructions above.

@andrewserong
Copy link
Contributor

Also seems like it might be related to: #44434

Just confirming that yes, I think this is the same underlying issue — just noticed from a different perspective 🙂
I believe the proposed fix in WordPress/wordpress-develop#3373 should resolve both issues.

@ockham
Copy link
Contributor

ockham commented Oct 4, 2022

If I'm not mistaken, this can also be reproduced with TT2 (with no changes to theme.json).

To test, insert some button blocks and view on the frontend. They should be rectangular, with a dark green background (rather than round and black).

Actual (broken) Expected (correct)
image image

(via WordPress/wordpress-develop#3352)

@ockham
Copy link
Contributor

ockham commented Oct 5, 2022

I've filed https://core.trac.wordpress.org/ticket/56736 to reflect this issue in Core.

@ockham
Copy link
Contributor

ockham commented Oct 5, 2022

I've filed a tentative fix over at WordPress/wordpress-develop#3408.

@oandregal
Copy link
Member

oandregal commented Oct 7, 2022

I cannot longer reproduce this bug with latest trunk.

@ockham
Copy link
Contributor

ockham commented Oct 7, 2022

I cannot longer reproduce this bug with latest trunk.

Thank you for verifying @oandregal!

Closing, as this has now been fixed by WordPress/wordpress-develop#3408.

@ockham ockham closed this as completed Oct 7, 2022
Repository owner moved this from In Progress to Done in WordPress 6.1 Editor Tasks Oct 7, 2022
pento pushed a commit to WordPress/wordpress-develop that referenced this issue Oct 11, 2022
A significant performance regression was added late in WP 6.1 beta cycle when some of the existing caching for `theme.json` processing was removed. The rationale for removing the caching was this code was now used before all the blocks are registered (aka get template data, etc.) and resulted in stale cache that created issues (see [WordPress/gutenberg#44434 Gutenberg Issue 44434] and [WordPress/gutenberg#44619 Gutenberg Issue 44619]). The changes were limited to only reads from the file system. However, it introduced a big impact in performance.

This commit adds caching and checks for blocks with different origins. How? It add caching for the calculated data for core, theme, and user based on the blocks that are registered. If the blocks haven't changed since the last time they were calculated for the origin, the cached data is returned. Otherwise, the data is recalculated and cached.

Essentially, this brings back the previous cache, but refreshing it when the blocks change.

It partially adds unit tests for these changes. Additional tests will be added.

References:
* [WordPress/gutenberg#44772 Performance regression in WP 6.1 for theme.json processing]

Follow-up to [54251], [54399].

Props aristath, oandregal, bernhard-reiter, spacedmonkey, hellofromTonya.
See #56467.

git-svn-id: https://develop.svn.wordpress.org/trunk@54493 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this issue Oct 11, 2022
A significant performance regression was added late in WP 6.1 beta cycle when some of the existing caching for `theme.json` processing was removed. The rationale for removing the caching was this code was now used before all the blocks are registered (aka get template data, etc.) and resulted in stale cache that created issues (see [WordPress/gutenberg#44434 Gutenberg Issue 44434] and [WordPress/gutenberg#44619 Gutenberg Issue 44619]). The changes were limited to only reads from the file system. However, it introduced a big impact in performance.

This commit adds caching and checks for blocks with different origins. How? It add caching for the calculated data for core, theme, and user based on the blocks that are registered. If the blocks haven't changed since the last time they were calculated for the origin, the cached data is returned. Otherwise, the data is recalculated and cached.

Essentially, this brings back the previous cache, but refreshing it when the blocks change.

It partially adds unit tests for these changes. Additional tests will be added.

References:
* [WordPress/gutenberg#44772 Performance regression in WP 6.1 for theme.json processing]

Follow-up to [54251], [54399].

Props aristath, oandregal, bernhard-reiter, spacedmonkey, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54493


git-svn-id: http://core.svn.wordpress.org/trunk@54052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
github-actions bot pushed a commit to platformsh/wordpress-performance that referenced this issue Oct 11, 2022
A significant performance regression was added late in WP 6.1 beta cycle when some of the existing caching for `theme.json` processing was removed. The rationale for removing the caching was this code was now used before all the blocks are registered (aka get template data, etc.) and resulted in stale cache that created issues (see [WordPress/gutenberg#44434 Gutenberg Issue 44434] and [WordPress/gutenberg#44619 Gutenberg Issue 44619]). The changes were limited to only reads from the file system. However, it introduced a big impact in performance.

This commit adds caching and checks for blocks with different origins. How? It add caching for the calculated data for core, theme, and user based on the blocks that are registered. If the blocks haven't changed since the last time they were calculated for the origin, the cached data is returned. Otherwise, the data is recalculated and cached.

Essentially, this brings back the previous cache, but refreshing it when the blocks change.

It partially adds unit tests for these changes. Additional tests will be added.

References:
* [WordPress/gutenberg#44772 Performance regression in WP 6.1 for theme.json processing]

Follow-up to [54251], [54399].

Props aristath, oandregal, bernhard-reiter, spacedmonkey, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54493


git-svn-id: https://core.svn.wordpress.org/trunk@54052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
ootwch pushed a commit to ootwch/wordpress-develop that referenced this issue Nov 4, 2022
A significant performance regression was added late in WP 6.1 beta cycle when some of the existing caching for `theme.json` processing was removed. The rationale for removing the caching was this code was now used before all the blocks are registered (aka get template data, etc.) and resulted in stale cache that created issues (see [WordPress/gutenberg#44434 Gutenberg Issue 44434] and [WordPress/gutenberg#44619 Gutenberg Issue 44619]). The changes were limited to only reads from the file system. However, it introduced a big impact in performance.

This commit adds caching and checks for blocks with different origins. How? It add caching for the calculated data for core, theme, and user based on the blocks that are registered. If the blocks haven't changed since the last time they were calculated for the origin, the cached data is returned. Otherwise, the data is recalculated and cached.

Essentially, this brings back the previous cache, but refreshing it when the blocks change.

It partially adds unit tests for these changes. Additional tests will be added.

References:
* [WordPress/gutenberg#44772 Performance regression in WP 6.1 for theme.json processing]

Follow-up to [54251], [54399].

Props aristath, oandregal, bernhard-reiter, spacedmonkey, hellofromTonya.
See #56467.

git-svn-id: https://develop.svn.wordpress.org/trunk@54493 602fd350-edb4-49c9-b593-d223f7449a82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

6 participants