Skip to content

Conversation

@wofferl
Copy link
Contributor

@wofferl wofferl commented Dec 1, 2025

Resolves: #7965

exact - Pass in true if you want the matching behaviour to be non-inclusive: https://router.vuejs.org/api/#exact

The exact prop for NcAppNavigationItem was removed in v9 without replacement.

The news app could now use this for a new feature (nextcloud/news#3148), to use /starred for all items and /starred/:feedId for sub items.

This PR adds the exact prop to control which active state - isExactActive or isActive - to use.

isExactActive: true if the [exact active class](https://v3.router.vuejs.org/api/#exact-active-class) should be applied. Allows to apply an arbitrary class

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable

@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.99%. Comparing base (e5737a2) to head (11ecdb8).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7939   +/-   ##
=======================================
  Coverage   52.99%   52.99%           
=======================================
  Files         100      100           
  Lines        3119     3119           
  Branches      867      868    +1     
=======================================
  Hits         1653     1653           
  Misses       1228     1228           
  Partials      238      238           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@ShGKme ShGKme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In v8 there was exact prop because NcAppNavigationItem is a wrapper over RouterLink which had the exact prop in the past in Vue 2. In other words, removed NcAppNavigationItem's exact prop followed removed <RouterLink>'s exact prop.

This prop was removed in Vue Router v4 (Vue 3) ~5 years ago: https://github.com/vuejs/rfcs/blob/master/active-rfcs/0028-router-active-link.md

In my opinion, we should not bring back a prop removed in the base component.

Also, isExactActive is different from old exact. It acts as exact-path, ignoring query and hash.

Adding a prop with the same name but different behaviour seems even more confusing to me and harder to catch. This means that a prop is not removed but changed between v8 and v9, which is still a breaking change from v8, but different from mentioned in the breaking change notes.

In the current case, I'd use isExactActive instead of isExact without additional configuration to always the the full path.

In addition, I'd make active optional but allow override router's active by active prop. So a developer can manually specify when a link is active in a more complex case (for example, with query/hash).

@ShGKme ShGKme added enhancement New feature or request 2. developing Work in progress labels Dec 9, 2025
@ShGKme ShGKme added this to the 9.4.0 milestone Dec 9, 2025
… prop to be able to overwrite the vue-router state

Signed-off-by: Wolfgang <github@linux-dude.de>
@wofferl wofferl force-pushed the feat_ncappnavigationitem_exact branch from da6e056 to 11ecdb8 Compare December 9, 2025 21:37
@wofferl wofferl changed the title feat(NcAppNavigationItem): reintroduce exact prop for exact route matching feat(NcAppNavigationItem): use exact route matching Dec 9, 2025
@wofferl wofferl requested a review from ShGKme December 9, 2025 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NcAppNavigationItem] has no option for exact route matching

2 participants