Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Avoid extra cascading parameter
  • Loading branch information
MackinnonBuck committed Aug 30, 2024
commit e1d15fd3bdd23d24094b0ce80a02192827f53168
8 changes: 4 additions & 4 deletions src/Components/test/testassets/BasicTestApp/Index.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@using Microsoft.AspNetCore.Components.Rendering
@using System.Web
@inject NavigationManager NavigationManager
<div id="test-selector">
Select test:
<select id="test-selector-select" @bind=SelectedComponentTypeName>
Expand Down Expand Up @@ -137,12 +139,10 @@
Type SelectedComponentType
=> SelectedComponentTypeName == "none" ? null : Type.GetType(SelectedComponentTypeName, throwOnError: true);

[SupplyParameterFromQuery(Name = "initial-component-type")]
private string InitialComponentTypeName { get; set; }

protected override void OnInitialized()
{
if (InitialComponentTypeName is { Length: > 0 } initialComponentTypeName)
var uri = new Uri(NavigationManager.Uri);
if (HttpUtility.ParseQueryString(uri.Query)["initial-component-type"] is { Length: > 0 } initialComponentTypeName)
{
SelectedComponentTypeName = initialComponentTypeName;
}
Expand Down