Skip to content

Commit ed037ca

Browse files
committed
Popup IAsyncDisposable implemented
1 parent 58f6239 commit ed037ca

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Radzen.Blazor/Rendering/Popup.razor

+16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@inherits RadzenComponent
2+
@implements IAsyncDisposable
23
@using Microsoft.JSInterop
34
<div @ref=@Element @onmousedown:preventDefault=@PreventDefault @attributes=@Attributes style=@Style id=@GetId()>
45
@if (open || !Lazy)
@@ -68,4 +69,19 @@
6869
{
6970
await JSRuntime.InvokeVoidAsync("Radzen.closePopup", GetId(), Reference, nameof(OnClose));
7071
}
72+
73+
public async ValueTask DisposeAsync()
74+
{
75+
if (IsJSRuntimeAvailable)
76+
{
77+
try
78+
{
79+
await JSRuntime.InvokeVoidAsync("Radzen.destroyPopup", GetId());
80+
}
81+
catch
82+
{
83+
// ignored
84+
}
85+
}
86+
}
7187
}

0 commit comments

Comments
 (0)