Skip to content

Commit

Permalink
fix: StatefulComponentBase - IHasIsDisposed check
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyakunin committed Nov 7, 2023
1 parent 3d1edf7 commit e00deaa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Stl.Fusion.Blazor/Components/StatefulComponentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ protected StateEventKind StateHasChangedTriggers {
protected bool MustCallStateHasChangedAfterEvent { get; set; } = false;

protected StatefulComponentBase()
=> StateChanged = (_, _) => this.NotifyStateHasChanged();
=> StateChanged = (_, _) => {
if (UntypedState is IHasIsDisposed { IsDisposed: true })
return;

this.NotifyStateHasChanged();
};

public virtual ValueTask DisposeAsync()
{
Expand Down

0 comments on commit e00deaa

Please sign in to comment.