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.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

Murz created an issue. See original summary.

murz’s picture

Issue summary: View changes
sumit-k’s picture

I 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.

sumit-k’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work

There 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.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.