Problem/Motivation
When adding cache tags to a view, they show up in the X-Drupal-Cache-Tags header correctly. When invalidating the tags nothing happens. Invalidating the existing (system) cache tag from the view clears the cache tag correctly, but custom cache tags not. Looking in the database the cache tags aren't added to the cache_render table at all, only the existing ones (for example "config:views.view.listing_1 rendered").
Custom cache tag added: custom:view.listing_1.user.{{ raw_arguments.null }}, which shows up in X-Drupal-Cache-Tags correctly like custom:view.listing_1.user.1
Version: Drupal 9.4.5 / Views 9.4.5 / Views Custom Cache Tag: 8.x-1.2
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 3322830-cache-tags.patch | 1021 bytes | ciprian.stavovei |
Issue fork views_custom_cache_tag-3322830
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 #2
pablovos commentedComment #3
pablovos commentedI wrongly assumed that CustomTags would also be added to individual rows but this is not the case. Adding this code to src/Plugin/views/cache/CustomTag.php solved the issue for us:
Comment #4
berdirhaven't really seen that before, I think entity rendered views don't use that, we usually use those. Makes sense, can you create that as a patch or merge request?
Comment #7
ciprian.stavovei commentedI also ran into this issue and code from #3 fixed it so I added a PR and a patch for it so that anybody can use it easily.
Comment #8
berdirThis has coding standard problems.
A test would be great, basically add an example view to the demo module and then assert it, similar to the existing test.