What triggers a Blazor component to re-render, and what changes are NOT automatically detected by the framework?
Last updated
Automatic re-render triggers: framework UI events (
@onclick), completion of lifecycle async tasks, new parameters from a parent, and explicitStateHasChangedcalls.Blazor has no change tracking on your data. Mutations from timers, background threads, external events, or silent collection changes are not detected.
For those cases call
StateHasChangedmanually, usingInvokeAsync(StateHasChanged)when on another thread.
- https://medium.com/@syeedmdtalha/shouldrender-and-statehaschanged-in-blazor-mastering-ui-rendering-control-9dd4509eed20
- https://learn.microsoft.com/en-us/aspnet/core/blazor/components/rendering?view=aspnetcore-10.0
- https://github.com/dotnet/aspnetcore/discussions/29318
- https://github.com/filipvalentin/useful_links
- https://jonhilton.net/blazor-rendering/
- https://www.telerik.com/blogs/blazor-basics-blazor-component-re-rendering