Problem/Motivation

My view is invalidated if I save user entity and I have taxonomy term as filter criteria in node listing view even though the cache tags are not reset. If I remove the filter criteria to taxonomy, view caches are not invalidated.

Steps to reproduce

  1. Create view block and set on page
  2. To make it more clearer, set view cache tag to something that does not exist eg foobar so it's always cached
  3. Add reference field to taxonomy and create filter critera for that in views
  4. Log in with some user other than 1
  5. Check that there are now new cache tags in the header variable x-drupal-cache-tags for the user 1 and the one you logged in. In my case it was user:1 user:1628
  6. Make sure the page is cached - load the view page multiple times and see the load times are faster after first load
  7. Execute this code:
    $user = User::load(UID 1 OR THE ONE YOU'RE LOGGED IN WITH);
    $user->save();
  8. Reload page - it should be takinga bit longer because view is invalidated

Proposed resolution

Maybe it's not issue with this module but would hope view is only cleared when that particular cache tag is invalidated.

Comments

hkirsman created an issue. See original summary.

hkirsman’s picture

Issue summary: View changes
hkirsman’s picture

Issue summary: View changes
hkirsman’s picture

Issue summary: View changes
hkirsman’s picture

Issue summary: View changes
berdir’s picture

Term filters sounds like this issue: #2352175: Taxonomy views filters should not have user context. We've been using the workaround patch for years, unless you have very specific use cases around term access that should be fine. Not sure how to get it into core.