MudBlazor link - reload data on same page

Viewed 608

I've a MudBlazor link element like this:

<MudNavLink Href="/orders" Match="NavLinkMatch.Prefix">Orders</MudNavLink>

This works fine, but when I'm on the exact same page as the link Href and link the link, it does not navigate. I would like it to force a reload making my page able to reload the data.

1 Answers

You can set the ForceLoad parameter. Take a look at the MudNavLink API for details.

You would want that parameter to be set to true only when on the same page.

@inject NavigationManager NavManager

<MudNavLink Href="/orders" Match="NavLinkMatch.Prefix"

ForceLoad="NavManager.Uri.Contains("orders")" >

Orders
</MudNavLink>

Keep in mind that force-loading means that the entire app will be reloaded, not just the page.

Related