Skip to content

Commit 863ce4a

Browse files
committed
App context switch to disable the update.
1 parent de2ee78 commit 863ce4a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Components/Web/src/Routing/NavLink.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ namespace Microsoft.AspNetCore.Components.Routing;
1313
/// </summary>
1414
public 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))

0 commit comments

Comments
 (0)