Skip to content

Components don't reset their received parameters during hot reload updates #31272

Closed
@SteveSandersonMS

Description

@SteveSandersonMS

It's a bit unusual to remove a parameter value that you're passing to a child component, but if you do, our upcoming hot-reload-refresh mechanism doesn't yet account for it.

Repro: In the default project template, in Index.razor, change this:

<SurveyPrompt Title="How is Blazor working for you?" />

... to this:

<SurveyPrompt />

No change will show up in the UI. This is because the existing SurveyPrompt instance already has a value for its Title property. Failing to supply a new value just means that the old one doesn't get overwritten.

Expected resolution

We can't control how all IComponent types deal with the removal of an incoming parameter value, but for ComponentBase at least, we can add some logic to SetParametersAsync that checks the IsHotReload flag and, if found, runs through some new code path to default-out all of its [Parameter] properties before receiving the new set from its parent.

Severity

Low. I don't think this is a common scenario at all.

Metadata

Metadata

Assignees

Labels

Priority:1Work that is critical for the release, but we could probably ship withoutarea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-hot-reloadThis issue is related to the Hot Reload feaature

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions