Skip to content

Conversation

@kmanijak
Copy link
Contributor

@kmanijak kmanijak commented Nov 12, 2025

Submission Review Guidelines:

Changes proposed in this Pull Request:

There's a regression in GB WordPress/gutenberg#73135 that Editor crashes (blank page) if you register a block with block.json that has:

  • no attributes definition - it's not required though
  • but uses supports.color field

As a temporary measure, this PR adds empty attributes to the block that matches the criteria causing post Editor to crash

Closes # .

(For Bug Fixes) Bug introduced in PR # .

Screenshots or screen recordings:

Before After

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. CI with GB nightly should pass: https://github.com/woocommerce/woocommerce/actions/runs/19292914676

Testing that has already taken place:

Changelog entry

  • Automatically create a changelog entry from the details below.
  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Changelog Entry Comment

Comment

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Nov 12, 2025
@claude
Copy link

claude bot commented Nov 12, 2025

Claude finished @kmanijak's task —— View job


BC Review Complete

Summary: Overall Risk Low

This PR adds an empty attributes: {} object to a single block.json file as a temporary workaround for a Gutenberg regression (GB #73135) where blocks with supports.color but no attributes definition cause the post editor to crash with a blank page.

The change is backwards compatible and low risk. Adding an empty attributes object does not alter block behavior, data storage, or API contracts. It's purely a schema addition that satisfies Gutenberg's internal validation requirements.


BC Analysis

What Changed

File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-label/block.json:11

+ "attributes": {},

Before: Block had no attributes key defined
After: Block has empty attributes: {} object

BC Impact Assessment

No Breaking Changes Detected

Why this is BC-safe:

  1. Block Attributes Schema: Adding an empty attributes object is semantically equivalent to having no attributes. WordPress/Gutenberg treats both cases identically when registering blocks - blocks without attributes simply have no configurable properties.

  2. Data Storage: No existing block instances in the database are affected. Blocks without attributes don't store attribute data, and this change doesn't introduce any new required attributes.

  3. Block Registration: The block name (woocommerce/add-to-cart-with-options-grouped-product-item-label) remains unchanged. All other metadata (supports, ancestor, apiVersion) is preserved.

  4. Rendering: No changes to display logic or template. The block continues to render using the same color/typography/spacing supports it had before.

  5. Extension Compatibility: Third-party extensions filtering or extending this block won't break - adding an empty object doesn't invalidate existing attribute filters or modifications.

Potential Risks (None Identified):

  • ❌ No public API signature changes
  • ❌ No hook additions/removals
  • ❌ No template modifications
  • ❌ No REST endpoint changes
  • ❌ No database schema changes
  • ❌ No JavaScript API changes

Additional Blocks at Risk

During analysis, I identified two other blocks with the same pattern (color support + no attributes) that may also crash the editor with Gutenberg nightly:

  1. plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-description/block.json

    • Has supports.color.gradients and supports.color.link
    • Missing attributes key entirely
  2. plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-title-items-counter-block/block.json

    • Has supports.color.text and supports.color.background
    • Missing attributes key entirely

Recommendation: Consider applying the same fix to these blocks in a follow-up PR once this workaround is validated, or wait for the upstream Gutenberg fix.


Testing Focus

Primary Regression Areas:

  1. Grouped Product Selector (directly affected)

    • Add grouped product to page/post in block editor
    • Verify editor doesn't crash (no blank page)
    • Verify color/typography controls still work in block settings
    • Verify product item label renders correctly on frontend
  2. Block Persistence

    • Create/edit page with this block, save, reload editor
    • Verify no block validation errors or recovery prompts
  3. Extension Compatibility

    • Test with extensions that modify grouped product blocks (if any)
    • Verify no console errors related to attribute access

Test Steps:

  1. ✅ CI with GB nightly passes (per PR description)
  2. Create new page with grouped product
  3. Customize item label colors/typography
  4. Save and reload editor
  5. Verify no blank screen, no console errors

Changelog Review

File: plugins/woocommerce/changelog/fix-e2e-with-gb-regresssion

Significance: patch
Type: tweak
Comment: Add empty attributes to the block.json to avoid editor crash. Temporary measure before there's a fix in GB

Changelog is appropriate

  • Correct significance (patch - minimal change, no API impact)
  • Correct type (tweak - minor adjustment)
  • Comment accurately describes temporary workaround nature

Confidence: 95%

Justification: This is a schema-only addition with no behavioral impact. The change pattern (empty attributes object) is well-understood in WordPress block development and widely used across core blocks. Risk is limited to potential edge cases in block serialization/deserialization, which are covered by existing WooCommerce block tests and GB nightly CI validation.

The 5% uncertainty accounts for:

  • Untested interaction with custom block extensions
  • Potential future GB behavior changes around empty attributes
  • Temporary workaround may need reverting after upstream fix

Ecosystem Impact

Payment Gateways: ❌ No impact (non-checkout block)
Subscriptions/Bookings: ❌ No impact (product display only)
Themes: ❌ No impact (no template changes)
Custom Checkout: ❌ No impact (not checkout-related)


Final Recommendation

Approve for merge

This is a safe, minimal workaround for a legitimate Gutenberg regression. The change follows best practices and includes appropriate changelog entry. No deprecation needed as this adds functionality rather than removing it.

Post-merge action: Monitor GB issue #73135 for upstream fix, then consider reverting this workaround or keeping it for older GB version compatibility.


@kmanijak kmanijak changed the title Temporary Editor crash patch by adding empty attributes to block.json Temporary patch for post Editor crash by empty attributes to block.json Nov 12, 2025
@kmanijak kmanijak requested a review from adimoldovan November 12, 2025 10:08
@kmanijak kmanijak marked this pull request as ready for review November 12, 2025 10:08
@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

Testing Guidelines

Hi @adimoldovan @dinhtungdu ,

Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

Reminder: PR reviewers are required to document testing performed. This includes:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

@woocommercebot woocommercebot requested review from a team and dinhtungdu and removed request for a team November 12, 2025 10:08
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

📝 Walkthrough

Walkthrough

This PR adds an empty attributes object to a Gutenberg block.json file as a temporary workaround to prevent editor crashes related to a Gutenberg regression. The change is classified as a patch-level tweak.

Changes

Cohort / File(s) Summary
Block Configuration
plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-label/block.json
Added empty "attributes": {} object to block manifest to prevent Gutenberg editor crashes
Changelog Metadata
plugins/woocommerce/changelog/fix-e2e-with-gb-regresssion
Added changelog entry documenting patch-level tweak with explanation of empty attributes workaround

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • The change is minimal and localized to a single configuration file
  • Verify that adding empty attributes does not impact block functionality or expected behavior
  • Confirm the changelog entry accurately reflects the nature and scope of the fix
  • Understand the specific Gutenberg regression being addressed to ensure this is an appropriate temporary solution

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding empty attributes to block.json as a temporary patch to prevent Editor crashes.
Description check ✅ Passed The description clearly explains the regression, the temporary workaround being implemented, and provides context about the Gutenberg issue and testing approach.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/e2e-with-gb-regresssion

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 901da7e and 9126402.

📒 Files selected for processing (2)
  • plugins/woocommerce/changelog/fix-e2e-with-gb-regresssion (1 hunks)
  • plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-label/block.json (1 hunks)
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: Aljullu
Repo: woocommerce/woocommerce PR: 61201
File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/product-image-gallery/edit.tsx:34-34
Timestamp: 2025-09-30T15:51:29.389Z
Learning: In WordPress blocks, `className` is managed through block supports (supports.className and supports.customClassName) rather than being a custom block attribute. The BlockEditProps generic type parameter should reflect only the custom attributes defined in block.json's attributes field, not the supports features.
📚 Learning: 2025-07-15T15:39:21.856Z
Learnt from: jorgeatorres
Repo: woocommerce/woocommerce PR: 59675
File: .github/workflows/release-bump-as-requirement.yml:48-65
Timestamp: 2025-07-15T15:39:21.856Z
Learning: In WooCommerce core repository, changelog entries for all PRs live in `plugins/woocommerce/changelog/` directory and are processed during releases, not at the repository root level.

Applied to files:

  • plugins/woocommerce/changelog/fix-e2e-with-gb-regresssion
📚 Learning: 2025-08-14T08:20:36.357Z
Learnt from: Aljullu
Repo: woocommerce/woocommerce PR: 60191
File: plugins/woocommerce/client/blocks/tests/e2e/tests/single-product-template/single-product-template-compatibility-layer.spec.ts:4-4
Timestamp: 2025-08-14T08:20:36.357Z
Learning: In WooCommerce e2e tests, some test files intentionally use hard-coded "woocommerce/woocommerce//" template IDs instead of BLOCK_THEME_SLUG to test backwards compatibility with the legacy plugin-scoped template ID format. These should not be updated to use the dynamic slug constant as they serve a specific testing purpose.

Applied to files:

  • plugins/woocommerce/changelog/fix-e2e-with-gb-regresssion
📚 Learning: 2025-08-07T10:34:27.723Z
Learnt from: jorgeatorres
Repo: woocommerce/woocommerce PR: 60250
File: .github/workflows/release-compile-changelog.yml:165-166
Timestamp: 2025-08-07T10:34:27.723Z
Learning: In WooCommerce release workflows, the VERSION variable used in changelog generation comes from the `validate-selected-branch-version` step, which extracts the version from `plugins/woocommerce/woocommerce.php` using `grep -oP '(?<=Version: )(.+)'` and validates it matches the input version. This ensures the version is always in the correct format by the time it reaches the changelog generation step, making additional error handling for version format validation unnecessary.

Applied to files:

  • plugins/woocommerce/changelog/fix-e2e-with-gb-regresssion
📚 Learning: 2025-09-12T09:29:11.840Z
Learnt from: Aljullu
Repo: woocommerce/woocommerce PR: 60767
File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/frontend.ts:246-253
Timestamp: 2025-09-12T09:29:11.840Z
Learning: In WooCommerce Add to Cart + Options blocks, when `childProductId` is defined (indicating a grouped product child), `selectedAttributes` is always an empty array. This is because grouped products don't have variations, so no additional guard is needed when passing `selectedAttributes` to `getProductData` for child product lookups.

Applied to files:

  • plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-label/block.json
📚 Learning: 2025-09-12T09:29:11.840Z
Learnt from: Aljullu
Repo: woocommerce/woocommerce PR: 60767
File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/frontend.ts:246-253
Timestamp: 2025-09-12T09:29:11.840Z
Learning: In WooCommerce Add to Cart + Options blocks, when `childProductId` is defined (indicating a grouped product child), `selectedAttributes` is always empty/undefined. This is because `selectedAttributes` is only initialized for variable products on the server side, and grouped products cannot be variable products simultaneously. Therefore, `getProductData` calls with `selectedAttributes` for child products work correctly without additional guards.

Applied to files:

  • plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-label/block.json
📚 Learning: 2025-08-22T11:04:16.818Z
Learnt from: yuliyan
Repo: woocommerce/woocommerce PR: 60554
File: plugins/woocommerce/templates/emails/block/customer-pos-completed-order.php:32-34
Timestamp: 2025-08-22T11:04:16.818Z
Learning: WordPress block.json schema does not have an "aliases" property. The "keywords" property is used for search/discovery terms, not block name aliases. Block name changes require block transforms to map old block names to new ones.

Applied to files:

  • plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-label/block.json
📚 Learning: 2025-08-22T10:24:05.067Z
Learnt from: yuliyan
Repo: woocommerce/woocommerce PR: 60554
File: plugins/woocommerce/client/blocks/bin/webpack-entries.js:62-62
Timestamp: 2025-08-22T10:24:05.067Z
Learning: WooCommerce blocks use their own block asset API system rather than standard WordPress block.json asset referencing. WC blocks extend AbstractBlock and use methods like get_block_type_editor_script() that leverage $this->asset_api->get_block_asset_build_path() to handle asset registration, instead of defining editorScript, viewScript, or style fields directly in block.json.

Applied to files:

  • plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-label/block.json
📚 Learning: 2025-07-24T05:37:00.907Z
Learnt from: dinhtungdu
Repo: woocommerce/woocommerce PR: 59900
File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/attribute-filter/inspector.tsx:0-0
Timestamp: 2025-07-24T05:37:00.907Z
Learning: The DisplayStyleSwitcher component in plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/components/display-style-switcher/index.tsx has been updated so that its onChange prop accepts only a string type (not string | number | undefined), eliminating the need for type assertions when using this component.

Applied to files:

  • plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-label/block.json
📚 Learning: 2025-09-30T15:51:29.389Z
Learnt from: Aljullu
Repo: woocommerce/woocommerce PR: 61201
File: plugins/woocommerce/client/blocks/assets/js/atomic/blocks/product-elements/product-image-gallery/edit.tsx:34-34
Timestamp: 2025-09-30T15:51:29.389Z
Learning: In WordPress blocks, `className` is managed through block supports (supports.className and supports.customClassName) rather than being a custom block attribute. The BlockEditProps generic type parameter should reflect only the custom attributes defined in block.json's attributes field, not the supports features.

Applied to files:

  • plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-label/block.json
📚 Learning: 2025-07-28T07:20:49.002Z
Learnt from: Aljullu
Repo: woocommerce/woocommerce PR: 60045
File: plugins/woocommerce/src/Blocks/BlockTypes/ProductGalleryThumbnails.php:68-68
Timestamp: 2025-07-28T07:20:49.002Z
Learning: WordPress block.json files support JSON schema pattern validation for string attributes using the "pattern" property with regular expression syntax, which provides client-side validation in the block editor.

Applied to files:

  • plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-label/block.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: review-with-tracking
  • GitHub Check: build

@github-actions
Copy link
Contributor

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit.

@tyxla
Copy link
Member

tyxla commented Nov 12, 2025

I think this is more of a core issue, and doing this will just hide it under the rug. If we do it, let's make sure to revert it afterwards.

Copy link
Contributor

@adimoldovan adimoldovan left a comment

Choose a reason for hiding this comment

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

Thanks for patching this @kmanijak

@kmanijak
Copy link
Contributor Author

I think this is more of a core issue, and doing this will just hide it under the rug. If we do it, let's make sure to revert it afterwards.

Yeah, we'll do! While I agree about hiding under the rug, we often noticed the opposite effect when keeping the error failing, would cover other issues happening at the same time because we get used to failing tests. So I'll keep it and will remove later on!

@kmanijak kmanijak merged commit ef1648e into trunk Nov 12, 2025
166 of 172 checks passed
@kmanijak kmanijak deleted the fix/e2e-with-gb-regresssion branch November 12, 2025 14:20
@github-actions github-actions bot added this to the 10.4.0 milestone Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants