Skip to content

Router displays NotFoundContent without any layout #10445

@SteveSandersonMS

Description

@SteveSandersonMS

Since we changed Router to have a NotFoundContent fragment instead of referencing a "fallback page" type, we've lost the convenience of having the content rendered inside a layout. It just renders very plainly (typically, black Times New Roman on a white screen).

This might not seem super important for the "not found" message, but we're also about to add "authorizing..." and "not authorized" content here too, and those really should be rendered inside a layout or the app will look flickery and weird as it jumps between displays styles.

Possible solution:

  • We add an extra DefaultLayout property to Router (of type System.Type, just like we used to for FallbackComponent).
    • Usage in template: <Router ... DefaultLayout="typeof(MainLayout)">
  • We also add the same DefaultLayout property to the LayoutDisplay component, and have Router automatically pass the value through
  • Then we update the rendering logic for LayoutDisplay so that, when the target doesn't define any layout, we use the DefaultLayout type
  • Finally, we make LayoutDisplay able to receive a RenderFragment as an alternative to a page type, i.e., it supports either. Then Router can render its NotFoundContent by passing the render fragment to LayoutDisplay

Metadata

Metadata

Labels

DoneThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing one

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions