Skip to content

Parameter not read from route #1580

Open
@JamesNK

Description

@JamesNK

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?

Metadata

Metadata

Assignees

Labels

investigateThis issue require further investigation before closing.needs designMore design is needed before this issue should result in a feature being implemented.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions