Closed (fixed)
Project:
Custom Elements
Version:
3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Feb 2026 at 16:09 UTC
Updated:
11 Mar 2026 at 17:00 UTC
Jump to comment: Most recent
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.
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
Comment #2
fagoComment #4
fagoComment #6
fagoComment #8
fagoI 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.