From f4e0d663fa75f8396b6123cb2d56eeb937eb4a42 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Thu, 22 Feb 2018 15:02:13 +0000 Subject: [PATCH] Tiny simplification to NavLink --- .../Routing/NavLink.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.AspNetCore.Blazor.Browser/Routing/NavLink.cs b/src/Microsoft.AspNetCore.Blazor.Browser/Routing/NavLink.cs index cf0dd43bc1..d7c4c7a5c2 100644 --- a/src/Microsoft.AspNetCore.Blazor.Browser/Routing/NavLink.cs +++ b/src/Microsoft.AspNetCore.Blazor.Browser/Routing/NavLink.cs @@ -56,19 +56,15 @@ namespace Microsoft.AspNetCore.Blazor.Browser.Routing public void Dispose() { - // To avoid leaking memory, it's important to detach any event handlers - // in Dispose(). + // To avoid leaking memory, it's important to detach any event handlers in Dispose() UriHelper.OnLocationChanged -= OnLocationChanged; } - private void OnLocationChanged(object sender, string e) + private void OnLocationChanged(object sender, string newUri) { // We could just re-render always, but for this component we know the // only relevant state change is to the _isActive property. - var shouldBeActiveNow = UriHelper.GetAbsoluteUri().Equals( - _hrefAbsolute, - StringComparison.Ordinal); - + var shouldBeActiveNow = newUri.Equals(_hrefAbsolute, StringComparison.Ordinal); if (shouldBeActiveNow != _isActive) { _isActive = shouldBeActiveNow;