-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed as not planned
Closed as not planned
Copy link
Labels
Pillar: Dev Experienceaffected-very-fewThis issue impacts very few customersThis issue impacts very few customersarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-razor.languagefeature-renderingFeatures dealing with how blazor renders componentsFeatures dealing with how blazor renders componentshelp candidateIndicates that the issues may be a good fit for community to help with. Requires work from eng. teamIndicates that the issues may be a good fit for community to help with. Requires work from eng. teamseverity-nice-to-haveThis label is used by an internal toolThis label is used by an internal tool
Milestone
Description
As reported here: #18307 (comment)
With this code,
@if (cat.IsBlack)
{
<input @key="@cat.Id" type="checkbox"
@onchange=@(eventArgs => { cat.IsBlack= (bool)eventArgs.Value; HandleCatColor(cat); })
checked />
}
else
{
<input @key="@cat.Id" type="checkbox"
@onchange=@(eventArgs => { cat.IsBlack= (bool)eventArgs.Value; HandleCatColor(cat); }) />
}
This should throw a clear exception about reuse of the same @key
value with a different sequence ID when toggling cat.IsBlack
as per docs:
Ensure that values used for @key don't clash. If clashing values are detected within the same parent element, Blazor throws an exception
However because of the if/else
, it doesn't throw but instead exhibits broken behavior.
This isn't super high priority because it's not a valid code pattern anyway. The issue is just that the error detection doesn't catch this particular case.
Metadata
Metadata
Assignees
Labels
Pillar: Dev Experienceaffected-very-fewThis issue impacts very few customersThis issue impacts very few customersarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-razor.languagefeature-renderingFeatures dealing with how blazor renders componentsFeatures dealing with how blazor renders componentshelp candidateIndicates that the issues may be a good fit for community to help with. Requires work from eng. teamIndicates that the issues may be a good fit for community to help with. Requires work from eng. teamseverity-nice-to-haveThis label is used by an internal toolThis label is used by an internal tool