Skip to content

Router displays NotFoundContent without any layout #10445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SteveSandersonMS opened this issue May 22, 2019 · 1 comment
Closed

Router displays NotFoundContent without any layout #10445

SteveSandersonMS opened this issue May 22, 2019 · 1 comment
Assignees
Labels
area-blazor Includes: Blazor, Razor Components Done This issue has been fixed enhancement This issue represents an ask for new feature or an enhancement to an existing one

Comments

@SteveSandersonMS
Copy link
Member

SteveSandersonMS commented May 22, 2019

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
@SteveSandersonMS
Copy link
Member Author

This is fixed (or at least, it's no longer applicable) with #12800

@SteveSandersonMS SteveSandersonMS added the Done This issue has been fixed label Aug 5, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components Done This issue has been fixed enhancement This issue represents an ask for new feature or an enhancement to an existing one
Projects
None yet
Development

No branches or pull requests

3 participants