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 do have an interactive router, then a navigation to a nonexistent URL won't match any of the
@page routes, 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
NotFound fragment. 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
I'm not saying any of these outcomes is wrong, but just that:
- It definitely doesn't make sense to pass the
NotFound parameter in the default project template
- It's confusing that you even can supply
NotFound content when there's no way it can ever be used (except if the developer manually configures a fallback route that maps all URLs to a RazorComponentResult that renders their top-level component).
We should at least consider whether it could make sense to map a fallback route automatically for this case.
The
<Router>component still accepts aNotFoundfragment (and we supply it in the default template), but it won't ever be used:Error: 404@pageroutes, and so the existing client-side routing logic causes it to do a full-page loadNotFoundfragment. 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 serverI'm not saying any of these outcomes is wrong, but just that:
NotFoundparameter in the default project templateNotFoundcontent 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.