Problem/Motivation
After updating from Drupal 10.3 to 10.4 this error emerged:
User warning: Trying to overwrite a cache redirect with one that has nothing in common, old one at address "languages:language_interface, theme, user.permissions" was pointing to "url.path.parent, url.path.is_front, route", new one points to "url.path, languages:language_url". in Drupal\Core\Cache\VariationCache->set() (line 138 of core/lib/Drupal/Core/Cache/VariationCache.php).
Steps to reproduce
No other actions beyond the update.
Proposed resolution
Apparently the cache context in the BreadcrumbBuilder needs to be enhanced. At least this appears to solve the problem in my case.
In BreadcrumbBuilder.php line 227 this row
$breadcrumb->addCacheContexts(['url.path']);
needs to be replaced by this:
$breadcrumb->addCacheContexts([
'url.path',
'languages:language_url',
'languages:language_interface',
'theme',
'user.permissions',
'url.path.parent',
'url.path.is_front',
'route'
]);Remaining tasks
Review suggestion and update the code.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 3498181-9.patch | 666 bytes | joe huggans |
Issue fork custom_breadcrumbs-3498181
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
betarobot commentedTested, works fine for me.
Comment #6
jonathanlgrrl commentedThe proposed resolution works, but you can also modify based on menu_breadcrumb's merge request that uses Drupal Core's CacheableMetadata.
Comment #7
jc8654 commentedComment #8
joe huggansTested this myself, and it does get rid of the error, seems to be working fine now as far as I can tell.
Comment #9
joe huggansProvided a patch for easier testing and use until this gets accepted
Comment #10
nrogers commentedWorks for me as well. Thanks!
Comment #11
subir_ghoshI ran into this error as well.
Patch works as of now.
Comment #13
lamp5