-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
The new NotFoundPage parameter in the Router component for blazor doesn't appear to work if you use it in conjunction with OnNavigateAsync. This is normally where I would delay load assemblies.
Expected Behavior
OnNavigateAsync shouldn't block the NotFoundPage functionality.
Steps To Reproduce
- Create a new project "dotnet new blazor"
- Launch the project and navigate to an invalid route, the not-found page is rendered.
- Modify the Routes.razor file to add use of OnNavigateAsync like below
<Router AppAssembly="typeof(Program).Assembly" OnNavigateAsync="OnNavigateAsync" NotFoundPage="typeof(Pages.NotFound)">
<Found Context="routeData">
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
<FocusOnNavigate RouteData="routeData" Selector="h1" />
</Found>
</Router>
@code {
private async Task OnNavigateAsync(NavigationContext args)
{
await Task.Yield();
}
}
- Launch the project and observe an invalid route results in a blank page
Exceptions (if any)
No response
.NET Version
10.0.100-rc.1.25451.107
Anything else?
No response
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components