Missing cache tags for CMS elements

Created on 24 April 2025, 1 day ago

Problem/Motivation

DXPR Builder dynamically renders Drupal blocks and views inside a field using renderRoot() and then injects the resulting HTML string directly into the output. However, the cacheability metadata (e.g., cache tags, contexts, max-age) generated during the rendering process is not bubbled up or applied to the final field render array.

As a result, any rendered block or view is not invalidated when underlying data changes โ€” leading to stale content being served despite otherwise correct cache setups.

Steps to reproduce

  1. Create a content type using a DXPR Builder field.
  2. Add a block inside the builder content (e.g., Latest Articles block).
  3. Save and view the node.
  4. Change the underlying content (e.g., publish a new article).
  5. Observe that the DXPR fieldโ€™s rendered block does not update unless the page cache is cleared manually.

Proposed resolution

  1. Capture the RenderContext during renderRoot() in the block rendering method.
  2. Extract the BubbleableMetadata from the context after rendering.
๐Ÿ› Bug report
Status

Active

Version

2.7

Component

Code

Created by

๐Ÿ‡จ๐Ÿ‡ฆCanada santerref

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024