Problem/Motivation
The anonymous user can never have different roles, so we don't need to add this cache tag.
Found this looking for something else - it seems to be added a lot by access policies to the static variation cache, so it may mean a bit less cacheablemetadata work hopefully.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3608738
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:
- 3608738-avoid-adding-user0
changes, plain diff MR !16229
Comments
Comment #2
catchI can only reproduce this being added a lot on Drupal 11.3, not main, so possibly something improved in the meantime.
Having said that, it also won't do any harm.
Comment #3
catchComment #5
kristiaanvandeneyndeAs discussed on Slack, this makes total sense. Depending on the scenario it might not improve things much, but not tagging stuff when you don't need to still beats tagging it for no reason.
Consider this RTBC, but awaiting test results.
Comment #6
berdirMakes sense, I would have gone with the suggestion of a $cacheability variable too personally, but that's just personal preference.
Comment #11
godotislateCommitted and pushedb3351dd to main, f7e2186 to 11.x, and d4fe6da to 11.4.x. Thanks!