NOTE: I create the issue and MR with the help of AI, changes are all reviewed and approved by me.
Problem
Canvas component sources put the cacheability of the resolved props on the component render array's #cache, but our render-covnert does not correctly pass them through. So some nested cache-metadata may get lost.
In more detail:
CustomElementPassthroughConverter::convert() returns $build['#custom_element'] without the build's #cache.
CanvasRenderConverter::convertComponent() builds the element from #props only.
CanvasRenderConverter::convertComponentContainer() drops the container's #cache when delegating to #component.
Steps to reproduce
- Enable canvas_extjs; create a Canvas page with an external JS component whose image prop references a media entity.
- Request the page as custom elements; note X-Drupal-Cache-Tags has no media:N.
- Edit the media; the cached CE output still shows the old values.
Proposed resolution
When the array has #cache, the converters add BubbleableMetadata::createFromRenderArray($build) to the element they return, like the other converters.
Issue fork custom_elements-3631698
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
Comment #3
fagoMR code is good and is proven to work well on an existing site already, all good!
Comment #5
fagoMerged.