Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Blazor] Custom CircuitHandler latency breaks WS connection on navigation #59657

Open
1 task done
garrettlondon1 opened this issue Dec 30, 2024 · 0 comments
Open
1 task done
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@garrettlondon1
Copy link

garrettlondon1 commented Dec 30, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

namespace Microsoft.AspNetCore.Components.Server.Circuits;

public class BlazorCircuitHandler() : CircuitHandler
{
    public override async Task OnCircuitOpenedAsync(Circuit circuit, CancellationToken cancellationToken)
    {
        await Task.Delay(2000);
        await base.OnCircuitOpenedAsync(circuit, cancellationToken);
    }

    public override async Task OnCircuitClosedAsync(Circuit circuit, CancellationToken cancellationToken)
    {
        await base.OnCircuitClosedAsync(circuit, cancellationToken);
    }
}

A lot of people use custom Blazor Server CircuitHandler implementations for initializing user state, connecting to SignalR Hubs, etc.

As seen in the video below, if you load a page with an InteractiveServer component, and navigate away before the circuit is opened, the whole circuit breaks. Thus, the whole app breaks.

Expected Behavior

This would be solved with #55127, because enhanced navigation would reopen the broken connection.

Steps To Reproduce

Add custom circuit handler implementation to services

Screen.Recording.2024-12-30.at.2.03.27.AM.mov

Exceptions (if any)

No response

.NET Version

9.0.100

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Dec 30, 2024
@garrettlondon1 garrettlondon1 changed the title [Blazor] Custom CircuitHandler breaks WS connection on navigation [Blazor] Custom CircuitHandler latency breaks WS connection on navigation Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

1 participant