Closed
Description
My .razor file looks as follows:
@page "/example"
@page "/example/{id}"
<h1>@ID</h1>
<NavLink href="/example/something">Something</NavLink>
<NavLink href="/example/">Nothing</NavLink>
<button onclick="@Show">Show</button>
@functions {
[Parameter]
public string ID { get; set; } = "Nothing";
public void Show()
{
Console.WriteLine(ID);
}
}
When I navigate to /example, the h1 tag contains "Nothing", as expected. If I now click on the NavLink "Something", the h1 tag contains "Something", also as expected.
But if I then click on the NavLink "Nothing", the URL in browser changes the right way, but the h1 tag still contains "Something".
If I check the value of by clicking the button, the console shows me "Something".
Is this a bug or a feature? I would have expected the h1 tag to contain an empty string.
If this is a feature, I would recommand to change that, because this makes it impossible to navigate from /example/something back to /example.
My setup:
- VS 2019
- ASP.NET Core 3.0
- Microsoft.AspNetCore.Blazor from NuGet (Version 3.0.0-preview4-19216-03)
- Default Blazor (ASP.NET Core hosted) Project