As mentioned in the subject line I wanted to know why the MudBlazor Tree View display the edit view on the 1st click but all subsequent clicks only change the URL & does not update the view. Please find the code snippet to the .razor file as well as the code behind.
Razor file snippet:
<MudTreeView Hover T="ClientTreeItem" ReadOnly Color="Color.Tertiary">
<MudTreeViewItem Text="Client List" Expanded="true">
@foreach (var client in Model)
{
<div @onclick="@(OpenContextMenu)" @oncontextmenu="@(OpenContextMenu)" @oncontextmenu:preventDefault @oncontextmenu:stopPropagation>
<MudTreeViewItem T="ClientTreeItem" Value="@CreateClientItem(client)" OnClick="@((e) => OnClientClick(client))" Text="@client.ClientName" Icon="@Icons.Material.Filled.Business" Expanded="false">
....
</div>
}
</MudTreeViewItem>
</MudTreeView>
Code behind file snippet:
private void OnClientClick(ClientNavigationContextDto client)
{
// Check if the client exists
if (client == null)
return;
EditClient(client.ClientId);
}
private void EditClient(int clientId)
{
// Navigate to edit page by ID
NavigationManager.NavigateTo($"/clients/{clientId}");
}
Output:
The on click of the client displays the edit view as expected!
All subsequent clicks on the client Tree view item update the URL but not the view as seen below.


onparametersetmethod so that when I click on another client the view gets updated!