Skip to content

Consider changing Router lazy loading flow to be based on EventCallback<T> #24215

@SteveSandersonMS

Description

@SteveSandersonMS

This would be desirable because then developers can understand OnNavigateAsync as being equivalent to any other event handler, in that:

  • It causes the host page to re-render both synchronously and asynchronously
  • Any cancelled tasks will be discarded

If we don't do it, and keep it as Func<NavigationContext, Task>, then the host page won't re-render in response to navigation (only the Router and its descendants will). This is a bit of an obscure edge case, but would be surprising and would be hard to fix without a breaking change in the future.

Just for the sake of preserving where we got to, here's a quick sketch of how EventCallback could be used for this.

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-blazor-lazy-loadingIssues related to adding support for lazy-loading in Blazorfeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssembly

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions