Since the fix #3025394: MenuActiveTrail should keep its cid (cache id) to avoid wrong cache sets for 403 was introduced in 9.1.x, I have noticed inconsistencies in the active menu trail. Since the patch, all of the active menu items are incorrect and instead have the active route as another route in the menu.
Before patch (active trails are correct)
/about -> /about is active (node 70)
/map -> /map is active (node 4)
/guide -> /guide is active (a Views page)
/privacy-policy -> /privacy-policy is active (node 1)
After patch (active trails are incorrect)
/about -> /privacy-policy is active (node 1)
/map -> /privacy-policy is active (node 1)
/guide -> /privacy-policy is active (node 1)
/privacy-policy -> /privacy-policy is active (node 1)
Interestingly, the incorrect route being points to is also node 1 on the project. Might be a niche case I have stumbled upon?
Comments
Comment #6
bbu23Hi. I also have issues with the active trail in menus.
I was looking at the
web/core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.phpfile, which callsweb/core/lib/Drupal/Core/Menu/MenuActiveTrail.php, where in my case two different paths are getting the default$active_trail = ['' => ''];instead of the actual trail. So, a page like home can == to a page like search because of that. This means that whichever page gets accessed first, that one will be the active trail and gets cached like that.