dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.05k stars 9.89k forks source link

Enhanced Navigation does not reopen broken socket connection #55127

Open garrettlondon1 opened 4 months ago

garrettlondon1 commented 4 months ago

Is there an existing issue for this?

Describe the bug

If WebSocket disconnects, then enhanced navigation goes to a page with another InteractiveServer components, the interactive component does not re-establish a connection

Expected Behavior

If Blazor is navigating to a page with an InteractiveServer component, and there is no WebSocket connection, or the existing WebSocket connection is severed, Enhanced navigation should initialize a new WebSocket connection after navigating

Steps To Reproduce

Create a StreamRendered component with an non-prerendered Interactive island

Disconnect from websockets

Navigate between SSR pages, which work over http Navigate back to the InteractiveServer(prerender:false) component

I have a private video I can share of this as well.

Exceptions (if any)

No response

.NET Version

8.0.4

Anything else?

No response

garrettlondon1 commented 4 months ago

Note: This cannot be tested with developer tools network throttling.

Wifi has to be disconnected in order to reproduce successfully.

Steps:

javiercn commented 4 months ago

@garrettlondon1 thanks for contacting us.

This seems like a bug. Probably there's some missing logic in our JS to try and re-stablish the connection if not available.

garrettlondon1 commented 4 months ago

I think you can only appreciate the gravity of the situation when pre-rendering is disabled.

What will happen is, your skeleton will load for interactive components, but none of your data. So your users will be switching between fully functional pages, depending on which render mode it is, and completely non-functional pages, when the render mode is InteractiveServer.

As demonstrated in the above video with prerendering true, the only effect is that the counter does not work.

In the below video, the entire counter component is not rendered, and a blank page appears. This is using the default Blazor Web template, only difference is switching Counter to @rendermode @(new InteractiveServerRenderMode(false))

https://github.com/dotnet/aspnetcore/assets/3959577/4688516a-461e-41e5-bb06-6bff3eb8dc7e