main ← fix/admin-sidebar-links-corrupted-on-setting-toggle
opened 03:39PM - 24 Mar 26 UTC
The admin sidebar's `@cached` `sections` getter calls `amendLinksToSection` on `…AdminNavManager`, which permanently mutates its internal `#adminNavMap`. When the getter re-evaluates (e.g. after toggling the `enable_form_templates` upcoming change via MessageBus), links accumulate: they persist after a setting is turned off and duplicate on repeated toggles.
This happens because `amendLinksToSection` pushes to the persistent `#adminNavMap` array, and there was no mechanism to reset it between evaluations.
The fix adds a `resetNavMap()` method to `AdminNavManager` and calls it at the start of each `sections` evaluation, ensuring a clean slate. This also makes the existing dedup guards (plugin link filtering, `linkExists` check for upcoming_changes) redundant, so they are removed along with an unnecessary closure wrapper for login route links.
https://meta.discourse.org/t/398151