Open
Description
Describe the bug
I have a page that I'm testing with some routes:
@page "/metrics"
@page "/metrics/resource/{ApplicationName}"
There are also some query string parameters:
[Parameter]
public string? ApplicationName { get; set; }
[Parameter]
[SupplyParameterFromQuery(Name = "meter")]
public string? MeterName { get; set; }
I have set a URL in navigation manager:
var navigationManager = Services.GetRequiredService<NavigationManager>();
navigationManager.NavigateTo("/metrics/resource/TestApp?meter=foo");
When the component is rendered I see the MeterName
parameter has a value, but the ApplicationName
is blank.
Now, I can fix that by manually setting the parameter value when calling RenderComponent
:
var cut = RenderComponent<Metrics>(builder =>
{
builder.Add(m => m.ApplicationName, "TestApp");
});
But part of the code I'm testing changes the current page with NavigateTo
, and I need ApplicationName
parameter to pick up its new value when navigation happens.
Why isn't ApplicationName
parameter value getting its value from the @page "/metrics/resource/{ApplicationName}"
page route?