Problem/Motivation

Cache tags for rendered patterns and their related block and pattern entities aren't being attached and bubbled. This means that updates to the underlying patternkit_pattern or patternkit_block entities don't properly invalidate caches where they appear. Cacheable metadata for these dependencies should be persisted on render to ensure caches can be properly invalidated when needed.

Outside of the typical UI-based editorial workflow, another common event that would need to trigger invalidation for pattern entity changes would be running the drush pklu command to update all pattern entities to use the latest template and schema data.

Steps to reproduce

  1. Enable cache tag header debugging
  2. Enable patternkit and patternkit_example modules
  3. Create a node with layout overrides enabled
  4. Edit the layout and place a patternkit block
  5. Save the layout
  6. View the node
  7. Review the X-Drupal-Cache-Tags header on the page response
  8. (X) Expect to see tags for the pattern, pattern entity, and pattern block

Proposed resolution

Add cache tag persistence for:

  • The pattern identifier for the pattern being rendered
  • The entity cache data for the patternkit_pattern entity being rendered by a block
  • The entity cache data for the patternkit_block entity being rendered in a block

Remaining tasks

  • Code review and testing

User interface changes

None

API changes

None

Data model changes

None

Issue fork patternkit-3307170

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

slucero created an issue. See original summary.

slucero’s picture

Status: Active » Needs review

I've uploaded an MR with proposed fixes for this issue. It bubbles up the following cache tags to pages where a patternkit block is displayed:

  • pattern:<pattern_name>
  • patternkit_pattern:<pattern_id>
  • patternkit_block:<block_id>

slucero’s picture

  • slucero committed 8372e3d on 9.1.x
    Issue #3307170 by slucero, mariohernandez: Cache tags aren't persisted...
slucero’s picture

Status: Needs review » Fixed

Merged for inclusion in the Beta 5 release!

Status: Fixed » Closed (fixed)

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