I have one custom ErrorBoundary component that I'm placing in MainLayout. If there is an error in any child component, it goes into an endless loop within the parent component.
I'm also including the link to the solution: https://github.com/accacc/EndlessLoop
@inherits ErrorBoundary@inject ISnackbar Snackbar@if (CurrentException is null){ @ChildContent}else if (ErrorContent is not null){ @ErrorContent(CurrentException)}else{ @ChildContent @foreach (var exception in receivedExceptions) { Snackbar.Add(@exception.Message, Severity.Error); @exception.Message }}@code { List<Exception> receivedExceptions = new(); protected override Task OnErrorAsync(Exception exception) { receivedExceptions.Add(exception); return base.OnErrorAsync(exception); }}Parent Component
@page "/"@inject ISnackbar Snackbar@using System.Net;<PageTitle>Index</PageTitle><h1>Hello, world!</h1>@error - @exWelcome to your new app.<SurveyPrompt Title="How is Blazor working for you?" /><MyComp></MyComp>@code{ public int error; public string ex; protected override Task OnInitializedAsync() { //Snackbar.Add("OK", Severity.Error); return base.OnInitializedAsync(); }}Child component
<h3>MyComp</h3>@error@code { public int error; protected async override Task OnInitializedAsync() { await Task.Delay(5); error++; throw new Exception("aaa"); }}