You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 26, 2025. It is now read-only.
I have a general question, just out of curiosity.
I can see there are serveral events being hooked in the oninitialized() of the component ( Blazored.Toasts.razor.cs):
protected override void OnInitialized()
{
ToastService.OnShow += ShowToast;
ToastService.OnShowComponent += ShowCustomToast;
ToastService.OnClearAll += ClearAll;
ToastService.OnClearToasts += ClearToasts;
ToastService.OnClearCustomToasts += ClearCustomToasts;
ToastService.OnClearQueue += ClearQueue;
ToastService.OnClearQueueToasts += ClearQueueToasts;
if (RemoveToastsOnNavigation)
{
NavigationManager.LocationChanged += ClearToasts;
}
if (IconType == IconType.Custom
&& string.IsNullOrWhiteSpace(InfoIcon)
&& string.IsNullOrWhiteSpace(SuccessIcon)
&& string.IsNullOrWhiteSpace(WarningIcon)
&& string.IsNullOrWhiteSpace(ErrorIcon))
{
throw new ArgumentException("IconType is Custom but icon parameters are not set.");
}
}
But I can't see them being unsubscribed or disposed, I get that this is a scoped service and events would eventually be cleaned up but wouldn't it be best practice to unsub from them anyway?
I have a general question, just out of curiosity.
I can see there are serveral events being hooked in the oninitialized() of the component ( Blazored.Toasts.razor.cs):
But I can't see them being unsubscribed or disposed, I get that this is a scoped service and events would eventually be cleaned up but wouldn't it be best practice to unsub from them anyway?
Forgive me if I'm getting this wrong.