Skip to content

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

Closed as not planned

Description

@ToolmakerSteve

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.

Activity

  1. ghost added
    area-blazorIncludes: Blazor, Razor Components
    on Nov 11, 2024
  2. mkArtakMSFT commented on Nov 11, 2024

    @mkArtakMSFT
    Contributor

    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.

  3. ToolmakerSteve commented on Nov 22, 2024

    @ToolmakerSteve
    Author

    @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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions