Browse Source

Check if the component is disposed

pull/17040/head
liangshiwei 3 years ago
parent
commit
4079298012
  1. 5
      framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/AbpComponentBase.cs
  2. 35
      framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs

5
framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/AbpComponentBase.cs

@ -168,6 +168,11 @@ public abstract class AbpComponentBase : OwningComponentBase
protected virtual async Task HandleErrorAsync(Exception exception) protected virtual async Task HandleErrorAsync(Exception exception)
{ {
if (IsDisposed)
{
return;
}
Logger.LogException(exception); Logger.LogException(exception);
await InvokeAsync(async () => await InvokeAsync(async () =>
{ {

35
framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs

@ -215,9 +215,9 @@ public abstract class AbpCrudPageBase<
protected async override Task OnInitializedAsync() protected async override Task OnInitializedAsync()
{ {
await SetPermissionsAsync(); await TrySetPermissionsAsync();
await SetEntityActionsAsync(); await TrySetEntityActionsAsync();
await SetTableColumnsAsync(); await TrySetTableColumnsAsync();
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
} }
@ -231,7 +231,15 @@ public abstract class AbpCrudPageBase<
await base.OnAfterRenderAsync(firstRender); await base.OnAfterRenderAsync(firstRender);
} }
private async Task TrySetPermissionsAsync()
{
if (IsDisposed)
{
return;
}
await SetPermissionsAsync();
}
protected virtual async Task SetPermissionsAsync() protected virtual async Task SetPermissionsAsync()
{ {
@ -579,13 +587,34 @@ public abstract class AbpCrudPageBase<
return ValueTask.CompletedTask; return ValueTask.CompletedTask;
} }
private async ValueTask TrySetEntityActionsAsync()
{
if (IsDisposed)
{
return;
}
await SetEntityActionsAsync();
}
protected virtual ValueTask SetEntityActionsAsync() protected virtual ValueTask SetEntityActionsAsync()
{ {
return ValueTask.CompletedTask; return ValueTask.CompletedTask;
} }
private async ValueTask TrySetTableColumnsAsync()
{
if (IsDisposed)
{
return;
}
await SetTableColumnsAsync();
}
protected virtual ValueTask SetTableColumnsAsync() protected virtual ValueTask SetTableColumnsAsync()
{ {
return ValueTask.CompletedTask; return ValueTask.CompletedTask;
} }

Loading…
Cancel
Save