Skip to content

Commit

Permalink
MudTimePicker: Fix dispose method (MudBlazor#9552)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielchalmers authored Aug 2, 2024
1 parent 17dfcfc commit 4b61df0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/MudBlazor/Components/TimePicker/MudTimePicker.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)

public async ValueTask DisposeAsync()
{
if (IsJSRuntimeAvailable && ClockElementReference.Id != null)
if (IsJSRuntimeAvailable)
{
await JsRuntime.InvokeVoidAsyncWithErrorHandling("mudTimePicker.destroyPointerEvents", ClockElementReference);
}
Expand Down
3 changes: 3 additions & 0 deletions src/MudBlazor/TScripts/mudTimePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ window.mudTimePicker = {
},

destroyPointerEvents: (container) => {
if (container == null) {
return;
}
// Clean up event listeners from the picker element
if (typeof container.destroy === 'function') {
container.destroy();
Expand Down

0 comments on commit 4b61df0

Please sign in to comment.