Cache Context Conflict in Breadcrumbs Causes Cache Redirect Overwrite Warning After Drupal 10.4 Upgrade

Created on 22 January 2025, about 2 months ago

Problem/Motivation

User warning: Trying to overwrite a cache redirect for "entity_view:block:*_breadcrumbs:[languages:language_interface]=en:[theme]=ca:[user.permissions]=is-admin" with one that has nothing in common, old one at address "languages:language_interface, theme, user.permissions" was pointing to "url", new one points to "url.path.parent, url.path.is_front, route". in Drupal\Core\Cache\VariationCache->set() (line 138 of core/lib/Drupal/Core/Cache/VariationCache.php).

Steps to reproduce

  1. Enable the *_breadcrumbs block on a page.
  2. Trigger a cache rebuild or visit a URL where the breadcrumb's cache is being generated.
  3. Observe the warning in the logs about a cache redirect conflict in VariationCache->set().

Proposed resolution

Ensure that cache contexts for the breadcrumbs include all required dependencies without causing conflicts. Update the code responsible for setting cache contexts to include a more comprehensive and compatible list.

For example, instead of using only url or url.path, explicitly specify all relevant contexts:

$breadcrumb->addCacheContexts([
    'route',
    'url',
    'url.path',
    'url.path.parent',
    'url.path.is_front',
    'languages:language_interface',
    'user.permissions',
    'theme',
]);

Remaining tasks

  • ✅ File an issue about this project
  • ❌ Addition/Change/Update/Fix to this project
  • ❌ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ➖ UX/UI designer responsibilities
  • ➖ Accessibility and Readability
  • ❌ Code review from 1 Varbase core team member
  • ❌ Full testing and approval
  • ❌ Credit contributors
  • ❌ Review with the product owner
  • ❌ Update Release Notes and Update Helper on new feature change/addition
  • ❌ Release

Varbase update type

  • ✅ No Update
  • ➖ Optional Update
  • ➖ Forced Update
  • ➖ Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A
🐛 Bug report
Status

Active

Version

9.1

Component

Code

Created by

🇯🇴Jordan n.ghunaim Amman - Jordan

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024