Skip to content

Unify NotFound behavior across render modes #62153

Open
@ilonatommy

Description

@ilonatommy

Problems that we would like to solve:

  • re-execution takes precedence over NotFound rendering,
  • url of page is changed when we're streaming, having the blazor's router,
  • not enough tests for each case, especially custom router tests.

This table presents current implementation for each combination of settings (Description) and actions to fix them (ToDo):

Application Interactivity Content render mode Default router Description ToDo
Global SSR non-streaming With Renderer is setting the status code to 404 and stopping the rendering. Router tries to render 404 fragment but the component invoker decides to finish rendering early and not to flush the response because it expects re-execution. The only way to show 404 page is to re-execute, otherwise we would see a default browser’s not found page: We should flush the response during rendering in component invoker regardless of returned code and re-execution middleware settings.
Per-component SSR non-streaming With Same situation as global interactivity. Row 1 solves it.
Global SSR streaming With The status code is already set; we cannot change it. Instead, we inject redirect command into JS with constant “not-found” route. We stop the renderer. We should not try to change the code nor JS-redirect. We should enable streaming in Router and allow it render the rest of the page.
Per-component SSR streaming With Same situation as global interactivity. Row 3 solves it.
Global Interactive With Same situation as 1st and 2nd scenario. Row 1 solves it.
Per-component Interactive With Impossible combination. We cannot render interactive page, not having interactivity registered for the application. -
Any SSR non-streaming Without The only way to render 404 page is to re-execute. No action needed.
Any SSR streaming Without Not tested. We should advice users with custom routers to enable streaming on them. In case they don't want to do it, we should add instructions in endpoint renderer to the response on how to redirect to "not found" page and read them in JS-side of streaming renderer. JS should do it only if Router did not flag NotFound as handled, e.g. in the event arguments.

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor Components

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions