Make WordPress Core

Opened 6 weeks ago

Closed 5 weeks ago

Last modified 5 weeks ago

#66003 closed enhancement (fixed)

Editor: Reuse the common block style schema during theme.json sanitization

Reported by: mreishus Owned by: jonsurrell
Priority: normal Milestone: 7.2
Component: Editor Version:
Severity: normal Keywords: has-patch has-unit-tests gutenberg-merge
Cc: Focuses: performance

Description

WP_Theme_JSON::sanitize() currently builds the same base and responsive style schemas separately for each block. For the most part, they are the exact same. Only blocks with psuedo states or custom states need extra data.

The related Gutenberg change builds the schema once before looping over all blocks, then assigns this to each block, while keeping the same block specific overrides as before. This avoids PHP copying data structures in memory while keeping the same output.

This tracks the backport of the Gutenberg PR to WP Core.

Gutenberg PR: ​https://github.com/WordPress/gutenberg/pull/82203

Change History (5)

#1 @mreishus
6 weeks ago

  • Focuses performance added

This ticket was mentioned in ​PR #13337 on ​WordPress/wordpress-develop by ​@mreishus.


6 weeks ago
#2

  • Keywords has-patch has-unit-tests added

Trac ticket: https://core.trac.wordpress.org/ticket/66003

Backport for: ​https://github.com/WordPress/gutenberg/pull/82203

## Use of AI Tools

AI assistance: Yes
Tool(s): ChatGPT
Model(s): GPT-5.6 Sol Pro
Used for: Brainstorming regression causes and test creation

#3 @wildworks
6 weeks ago

  • Keywords gutenberg-merge added

#4 @jonsurrell
5 weeks ago

  • Owner set to jonsurrell
  • Resolution → fixed
  • Status new → closed

In 63512:

Editor: Reuse a common block schema during theme.json sanitization.

WP_Theme_JSON::sanitize() rebuilt an identical settings and styles schema for every valid block name. Both schemas are now built once and reused, with block-specific pseudo-selector and custom state entries still added per block. The sanitized output is unchanged.

Backported from ​https://github.com/WordPress/gutenberg/pull/82203.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/13337

Props mreishus.
Fixes #66003.

#5 @jonsurrell
5 weeks ago

  • Milestone Awaiting Review → 7.2
Note: See TracTickets for help on using tickets.