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
- Enable cache tag header debugging
- Enable patternkit and patternkit_example modules
- Create a node with layout overrides enabled
- Edit the layout and place a patternkit block
- Save the layout
- View the node
- Review the
X-Drupal-Cache-Tagsheader on the page response - (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_patternentity being rendered by a block - The entity cache data for the
patternkit_blockentity 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
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
sluceroI'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>Comment #5
sluceroComment #7
sluceroMerged for inclusion in the Beta 5 release!