I have a standard .NET 6 MVC website. I added some server blazor components that run from a view. Occasionally the component will not load on the page. Pressing refresh or enter on the url fixes the issue. The Console in the Dev Tools shows no errors. The network tab does not show any issues either.
Additionally the button press for some controls also stops working. Reload and the events start firing. Also the same Dev Tools response, no console errors or network errors.
My MVC View:
@(await Html.RenderComponentAsync<BlazorCom1>(RenderMode.Server, new { userid= Model.Id }));My Blazor Component (Simplfied)
<button id="adduser" type="submit" @onclick="adduser" class="">Add User</button>@code{[Parameter]public int userId{ get; set; }protected override async Task OnInitializedAsync(){ await this.Refresh();}public async Task Refresh(){ //Does calls to our backend for data}private void adduser(){ //Do stuff on backend}}It is definitely more pronounced on the external webserver vs localhost. It has happened on the localhost but significantly less. My server has websockets turned on.
What can I turn on to get more information about what could be happening?What should I look for in my startup for what is being loaded or what could be a conflict?
The Code above does not actually demonstrate the issue because by all accounts this problem should not occur. There is something wrong in the Blazor Transport Layer. Press refresh once or twice and it works. No errors in the developer console or in the network tabs. I am thinking this has something to do with Retrofitting Blazor into an existing mvc application. Usually by the time I post here I have exhausted all obvious solutions and I am hoping the hive mind here has someone who stumbled on a similar issue.