Browse Source

Merge pull request #17040 from abpframework/liangshiwei/ui-blazor

Check if the component is disposed
pull/17048/head
Enis Necipoglu 3 years ago
committed by GitHub
parent
commit
dfcd5e8bc6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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)
{
if (IsDisposed)
{
return;
}
Logger.LogException(exception);
await InvokeAsync(async () =>
{

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

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

Loading…
Cancel
Save