Skip to content

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

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

Closed
1 task done
ToolmakerSteve opened this issue Nov 11, 2024 · 2 comments
Closed
1 task done
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-boot-up

Comments

@ToolmakerSteve
Copy link

ToolmakerSteve commented Nov 11, 2024

Is there an existing issue for this?

  • I have searched the existing issues

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 #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.

@ghost ghost added the area-blazor Includes: Blazor, Razor Components label Nov 11, 2024
@mkArtakMSFT
Copy link
Contributor

mkArtakMSFT commented Nov 11, 2024

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.

@mkArtakMSFT mkArtakMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2024
@ToolmakerSteve
Copy link
Author

ToolmakerSteve commented Nov 22, 2024

@mkArtakMSFT - You might be thinking about a different scenario than what I encountered.

It behaves correctly (counter button is responsive) if I wait longer before selecting counter page. This suggests that in the failed test, at the time Blazor went to counter page, WebAsm was not ready (still downloading perhaps?), but Blazor switched to WebAsm anyway.

To be clear: I am not asking for dynamic switching. I encountered a situation where (AFAIK) it would work better to not switch to WebAsm yet. Stay on Server Render until a SECOND page switch. Is there a downside to delaying that long?

When user switches page, is it easy to determine whether WebAssembly is ready to start up?

Currently, there does not appear to be such a check. Blazor simply assumes the first page switch, it can switch to WebAsm. Even if WebAssembly is still being downloaded. At least that is how I interpret the tests I did.

Is my understanding of what is happening incorrect? Is there logic in Blazor to check whether WebAsm is available / can be started now? Is that check done at the time user selects a different page?

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 feature-blazor-boot-up
Projects
None yet
Development

No branches or pull requests

2 participants