When enabling the "Domain"-module, I seem to run into this error:
The complete set of cache contexts for a variation cache item must contain all of the initial cache contexts, missing: user.site
I saw in the cache contexts that the exact ones listed in the default value of the container parameter `render.config:required_cache_contexts` were used, but when looking at the NavigationRenderer, they're hardcoded into it.
If I replace the hardcoded contexts list on line 133 in the NavigationRenderer:
$build[$delta]['#cache']['contexts'] = ['user.permissions', 'theme', 'languages:language_interface'];
With this code:
$renderer_config = \Drupal::getContainer()->getParameter('renderer.config');
$build[$delta]['#cache']['contexts'] = $renderer_config['required_cache_contexts']
?? ['user.permissions', 'theme', 'languages:language_interface'];
Then it seems to work (since I've added `user.list` as a required context in my services file).
- Start on an empty Drupal 11 website
- Enable the Navigation and Domain modules
I think, using the container parameter renderer.config:required_cache_contexts instead of the hardcoded list:
- user.permissions
- theme
- languages:language_interface
Should be fine? Unless I completely misunderstand this functionality.
Active
1.0
Code