Skip to content

chore: fix nested nav items expanded state

Paul Gascou-Vaillancourt requested to merge 1064-fix-expanded-items into main

This prevents nested nav items from being unnecessarily expanded when only their parent is actually active.

Before those changes, the items were being expanded by matching the current route with the nav item's path. Fixing this based on that approach seemed impossible because of how nested items are built: it's possible for deeply nested nav items to have a parent that doesn't have a path, so they inherit their parent's parent' path and so on.

This MR completely changes the approach by converting the JSON configuration into a tree that represents all of the navigation items and their states. This makes the state changes more manageable, and makes it easier to match a given route with a nav item, no matter how deeply it is nested in the tree.

Closes #1064 (closed)

Edited by Paul Gascou-Vaillancourt

Merge request reports