-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Custom event handlers in Blazor components not updating after render tree changes #11947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for contacting us, @vaughanroberts. |
Thanks @mkArtakMSFT for the follow up, it's my first issue submission and it looks like it could of been a bit clearer. :) I had tried The following screenshots should help illustrate the issue. The first screenshot shows the result of clicking on each row before inserting any new rows. This works as expected with the click event updating the counter, the After inserting a new row into position 3, clicking on the first two rows work as above, however the (new) third and (existing) fourth row's change property events aren't handled correctly. The component in row 3 doesn't handle the event at all. The component in row 4 appears to receive the event for row 3 as well as it's own. Inserting (or removing) further rows continues to increase this issue. You can see from the code sample where I have tried calling I can't see where else calling Cheers. |
Thanks for the details, @vaughanroberts. Having said that, we'll review this with the team one more time to see whether there is something else going on here. In the meantime, please look into the referenced feature and see whether that would help. |
Thanks @mkArtakMSFT, this looks like exactly what I needed, apologies for overlooking it. For other reader's benefit, I also had to implement Cheers. |
@vaughanroberts It is a little late but you can also read this #11908. It was fixed and will be available in Preview 8. |
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.
The text was updated successfully, but these errors were encountered: