Problem

The cache metadata is lost in CustomElement::setSlotFromRenderArray() due to by-value capture. This came up-in / caused #3575660: Form-building fails passing through cache metadata

In CustomElement::setSlotFromRenderArray(), the render array $build is passed DeprecationHelper::backwardsCompatibleCall() via arrow functions (fn()). Arrow functions capture variables by value, creating a copy.

Drupal's renderer correctly bubbles child cache metadata - this is critical to have.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fago created an issue. See original summary.

fago’s picture

Issue summary: View changes

fago’s picture

Status: Active » Needs review

  • fago committed 5bf6d126 on 3.x
    fix: #3575750 Cache metadata lost in CustomElement::...
fago’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

fago’s picture

I worked on this with claude code and created a fix. The fix is good, solves the issue and comes with test-coverage. I fully reviewed and test, thus merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.