Skip to content

Add support for rendering Blazor components on applying a hot reload delta #30816

@pranavkm

Description

@pranavkm
  • Assume some mechanism exists that notifies the framework when a delta is applied.
  • We introduce a new contract that is implemented by ComponentBase. This allows components to subscribe to events that make them aware that a rendering is being triggered as a response to delta apply event:
IHotReloadableComponent
{
    void UseHotReloadableContext(HotReloadableContext context);
}

class HotReloadableContext
{
    bool IsHotReloading();
}
  • ComponentBase.ShouldRender() is ignored when Context.IsHotReloading() returns true.
  • RenderRootComponentAsync stashes away root component parameters when we know hot reload is enabled for the app (look for the environment variable) and uses this to trigger a render when delta is applied.

Metadata

Metadata

Assignees

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
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions