Skip to content

Custom event handlers in Blazor components not updating after render tree changes #11947

Closed
@vaughanroberts

Description

@vaughanroberts

I have a PropertyChangedEventHandler attached to an object in a custom component representing a table cell that works as expected until rows in the table are added or removed.
When a row is added or removed the custom events in components following that row are not attached to the correct cells.
To be clear, the normal UI events, 'onclick' etc, work correctly. However if a field in my underlying object is changed then the PropertyChanged event will be fired in a component on an incorrect table row. Depending on where I register the event it may be fired on the last row of the table or from a row above the correct row.

I have tried registering the PropertyChanged event in the component's OnInit and OnParametersSet events but they both produce incorrect behavior.

I've attached a sample project that reproduces this behavior and traces the output to the console. After inserting rows into the table, the first two rows will continue report the correct PropertChanged information, but further rows will not.

EventTest.zip

Additional context:

Blazor v3.0.0-preview6.190307.2

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions