-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-full-stack-web-uiFull stack web UI with BlazorFull stack web UI with Blazorfeature-templates
Milestone
Description
The <Router> component still accepts a NotFound fragment (and we supply it in the default template), but it won't ever be used:
- If you don't have an interactive router, then a navigation to a nonexistent URL will return a 404 from the server, and then:
- If you have enhanced nav enabled (default) then you'll see
Error: 404 - If you don't have enhanced nav enabled, then you'll see either the browser's built-in 404 UI or any custom 404 page returned by the ASP.NET Core server
- If you have enhanced nav enabled (default) then you'll see
- If you do have an interactive router, then a navigation to a nonexistent URL won't match any of the
@pageroutes, and so the existing client-side routing logic causes it to do a full-page load- Historically with fallback routing this would take you back into the Blazor UI which would then render the
NotFoundfragment. But since we no longer have fallback routing, you'll now see either the browser's built-in 404 UI or any custom 404 page returned by the ASP.NET Core server
- Historically with fallback routing this would take you back into the Blazor UI which would then render the
I'm not saying any of these outcomes is wrong, but just that:
- It definitely doesn't make sense to pass the
NotFoundparameter in the default project template - It's confusing that you even can supply
NotFoundcontent when there's no way it can ever be used (except if the developer manually configures a fallback route that maps all URLs to aRazorComponentResultthat renders their top-level component).
We should at least consider whether it could make sense to map a fallback route automatically for this case.
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-full-stack-web-uiFull stack web UI with BlazorFull stack web UI with Blazorfeature-templates