Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a menu block that lists all 2nd level items for a fixed parent. Whenever I add a new menu item in this tree (using node/add menu settings), the item is not displayed until I rebuild the cache. The item IS displayed in a core menu block, but not in the Menu Block menu block.
Any thoughts?
Comments
Comment #2
grahamCI had been noticing this also - after a bit of digging, I understand what's happening:
When a new link is added to a menu, a cache tag for that menu is cleared (e.g.
config:system.menu.footer
)When loading the menu in the Block build() method, since we pass NULL into MenuLinkTree::load() as a menu name, the cache tag generated is
config:system.menu.
, and since that wasn't cleared the stale cached data is used.I see there's already a patch to fix another cache issue at #2833076-5: Clearing cache when a menu link is added or deleted, and for me it resolves this issue too!
Comment #3
mithenks CreditAttribution: mithenks at bmeme commentedSolved by #2833076 - Clearing cache when a menu link is added or deleted