Skip to content

Commit

Permalink
🐛 fix: Optimize the logic of component disposing (#1745)
Browse files Browse the repository at this point in the history
  • Loading branch information
capdiem authored Jan 31, 2024
1 parent 0d98881 commit fdac246
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/Masa.Blazor.Docs/Components/Examples/Example.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ private static List<RazorExtension> GetRazorExtension()
.Cast<RazorExtension>().ToList();
}

protected override ValueTask DisposeAsync(bool disposing)
protected override ValueTask DisposeAsyncCore()
{
_objRef?.Dispose();
return base.DisposeAsync(disposing);
return base.DisposeAsyncCore();
}
}
4 changes: 2 additions & 2 deletions docs/Masa.Docs.Shared/Shared/Toc.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ private string GenClass(MarkdownItTocContent tocContent)
return builder.ToString();
}

protected override ValueTask DisposeAsync(bool disposing)
protected override ValueTask DisposeAsyncCore()
{
AppService.TocChanged -= AppServiceOnTocChanged;
return base.DisposeAsync(disposing);
return base.DisposeAsyncCore();
}
}
1 change: 1 addition & 0 deletions docs/Masa.Docs.Shared/wwwroot/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"upgrade-guide": "Upgrade guide",
"contributing": "Contributing",
"styles-and-animations": "Styles and animations",
"ui-components": "Components",
"features": "Features",
"border-radius": "Border radius",
"color": "Colors",
Expand Down
4 changes: 2 additions & 2 deletions src/Masa.Blazor.SomethingSkia/Watermark/MWatermark.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ private string ConvertBitmapToBase64(SKBitmap bitmap)
return Convert.ToBase64String(imageBytes);
}

protected override ValueTask DisposeAsync(bool disposing)
protected override ValueTask DisposeAsyncCore()
{
_originalBitmap?.Dispose();
return base.DisposeAsync(disposing);
return base.DisposeAsyncCore();
}
}
4 changes: 2 additions & 2 deletions src/Masa.Try.Shared/Pages/Index.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ private void ClearInputs()
_newScriptContent = string.Empty;
}

protected override ValueTask DisposeAsync(bool disposing)
protected override ValueTask DisposeAsyncCore()
{
_objRef?.Dispose();
return base.DisposeAsync(disposing);
return base.DisposeAsyncCore();
}

[GeneratedRegex("(<script(.*?)>)(.|\n)*?(</script>)")]
Expand Down

0 comments on commit fdac246

Please sign in to comment.