File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
src/Components/Web/src/Routing Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ namespace Microsoft.AspNetCore.Components.Routing;
1313/// </summary>
1414public class NavLink : ComponentBase , IDisposable
1515{
16+ private const string DisableMatchAllIgnoresLeftUriPartSwitchKey = "Microsoft.AspNetCore.Components.Routing.NavLink.DisableMatchAllIgnoresLeftUriPart" ;
17+ private readonly bool _disableMatchAllIgnoresLeftUriPart = AppContext . TryGetSwitch ( DisableMatchAllIgnoresLeftUriPartSwitchKey , out var switchValue ) && switchValue ;
18+
1619 private const string DefaultActiveClass = "active" ;
1720
1821 private bool _isActive ;
@@ -129,6 +132,11 @@ protected virtual bool ShouldMatch(string currentUriAbsolute)
129132 return true ;
130133 }
131134
135+ if ( _disableMatchAllIgnoresLeftUriPart )
136+ {
137+ return false ;
138+ }
139+
132140 string uriWithoutQueryAndFragment = GetUriIgnoreQueryAndFragment ( currentUriAbsolute ) ;
133141 if ( Match == NavLinkMatch . All
134142 && EqualsHrefExactlyOrIfTrailingSlashAdded ( uriWithoutQueryAndFragment ) )
You can’t perform that action at this time.
0 commit comments