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.47k stars 10.03k forks source link

Blazor Web App / Auto Mode / Counter button not responsive if switch to that page quickly #58860

Closed ToolmakerSteve closed 1 day ago

ToolmakerSteve commented 2 days ago

Is there an existing issue for this?

Describe the bug

New Project / Blazor Web App / Interactive Render Mode = Auto.

Launch under debugger. Quickly switch to Counter page, and quickly press Counter.

It does not respond (WASM not yet loaded).

Expected Behavior

Counter is always responsive.

(Stay in Server Render Mode, until a page switch occurs AND WASM is ready.)

IMHO, this should be the default behavior: "Keep simple cases simple".

To put it another way: what possible benefit is there to switching to client rendering when Blazor knows perfectly well that cannot work yet!

Steps To Reproduce

See bug description.

Exceptions (if any)

No response

.NET Version

latest 8.0

Anything else?

This bug appears to be "by design", and probably covered by https://github.com/dotnet/aspnetcore/issues/53799, as well as similar issues.

Nevertheless, even the simplest app reveals a problem with the current logic for switching between server and client rendering.

Please don't lose sight of this fact.

mkArtakMSFT commented 1 day ago

Thanks for contacting us.

We don't have a way to dynamically switch from server-interactivity to WebAssembly interactivity, and starting up the WebAssembly blocks the UI thread, which usually takes less than 0.5 second on the published app. This is something on our mind and hopefully sometime in the future we come up with a better solution here.