The menu configuration cache is cleared on each save of any menu_link_content entity

Created on 9 June 2023, about 1 year ago
Updated 21 June 2023, about 1 year ago

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

🐛 Bug report
Status

Needs work

Version

10.1

Component
Menu system 

Last updated 1 day ago

Created by

🇦🇲Armenia Murz Yerevan, Armenia

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

Comments & Activities

Production build 0.71.5 2024