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.

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

Status: Active » Reviewed & tested by the community

MR code is good and is proven to work well on an existing site already, all good!

  • fago committed 4474236d on 3.x
    fix: #3631698 Render converters drop the cache metadata of Canvas...
fago’s picture

Status: Reviewed & tested by the community » Fixed

Merged.

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.

Status: Fixed » Closed (fixed)

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