Cache tags not added to View

Created on 1 October 2021, over 3 years ago
Updated 29 March 2023, about 2 years ago

Problem/Motivation

There is no problem with caching as long as the entity type returned by the View is the same as the entity type used in the default argument. However, if the View returns Nodes but the default_argument is using fields from something else like Term or User, then the View should be invalidated when that Term or User is updated. Currently the View does not get invalidated.

Steps to reproduce

  1. Do a Standard install and enable this module.
  2. Add an integer field to Tags.
  3. Create a View of Nodes with a contextual filter for Content ID using views_arg_entity_default with entity type Taxonomy Term with the integer field you just created.
  4. Put the View in a block on term pages.
  5. Create Node 1 and Node 2
  6. Create a Tag where the integer field has the value 1.
  7. View that term. Node 1 should be returned in the View.
  8. Edit the Tag so the integer field is 2 instead of 1.
  9. View the term. Node 1 is still returned by the view even though it should be node 2.

This is an unrealistic example obviously but it shows the bug.

Proposed resolution

Add cache tags as shown in #2853592: Cacheability metadata can't be set from within argument default handlers. β†’

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024