Problem/Motivation
On saving any "menu_link_content" entity, I see that the cache of the configuration of the related menu is always cleared, but the configuration should have no changes by this operation.
After saving a menu item in "footer" menu, using Drupal Admin UI, the first call happens with these cache tags:
- "menu_link_content_list"
- "menu_link_content_list:footer"
- "4xx-response"
And then, the second call - with clearing the menu config:
- "config:system.menu.footer"
Steps to reproduce
1. Get a clean Drupal installation.
2. Set a breakpoint to function CacheTagsInvalidator::invalidateTags()
3. Open the "Footer" menu: /admin/structure/menu/manage/footer, click on the "Add link" button.
4. Add a new item with any name and link, and press "Save".
See that the "config:system.menu.footer" tag is invalidated.
5. Edit the created menu item and save it again.
See that the "config:system.menu.footer" tag is invalidated again.
Proposed resolution
The menu configuration has no stored information, related to its items, here is an example:
uuid: 41570d25-8790-4c10-9f19-e5b986b0f31e
langcode: en
status: true
dependencies: { }
_core:
default_config_hash: 7yrlW5z9zdg2eBucB2GPqXKSMQfH9lSRSO4DbWF7AFc
id: footer
label: Footer
description: 'Site information links'
locked: true
So, from my point of view, clearing the configuration cache is unnecessary for this case.
Comments
Comment #2
murzComment #3
sumit-k commentedI have successfully replicated the scenario, and it appears that removing Menu config entities makes sense in this context. It seems that this issue has already been reported in the ticket https://www.drupal.org/project/drupal/issues/2488918. In Drupal 10, this behavior is considered to be working as designed. It seems that this task will be addressed in the upcoming Drupal version 11.
Comment #4
sumit-k commentedComment #5
smustgrave commentedThere appears to be no patch to review. But would bring up #contribute if you are asking if this is by design.
Maybe a test-only patch to show the issue could also help.
Comment #7
andypostComment #9
pameeela commentedI think this is a duplicate of #2488918: Use 'menu:<menu name>' as cache tag for menus instead of 'config:system.menu:<menu name>' to avoid coupling