I've been experimenting with Blazor in .NET 8 and I'm trying to understand how the Auto-render mode works. From what I've learned, Blazor initially uses a WebSocket connection in Auto mode to provide interactivity via server-side rendering. Then, it switches to WebAssembly (WASM) when the WASM resources are loaded in the background.
However, in my tests, I've noticed that there's no interactivity available until the WASM resources are fully loaded. In the network tab of my browser, I can see a WebSocket connection, but it seems like the UI is just prerendered and not interactive.
I've also learned that components that are going to be rendered in WASM should be placed in the ProjectName.Client
project and these components can't be set to any render mode other than WASM (including Server mode). But if Auto mode requires the components to be interactive via a WebSocket connection (like what we have in Blazor Server apps) for the first time, how can these components be placed in the ProjectName.Client
project?
In my tests, I've enabled network throttling to simulate a slow network, and I've found that Auto mode behaves almost the same as the WASM render mode. Both modes offer prerendering, but there's no interactivity until the WASM resources are loaded, even in auto mode.
Additionally, I've noticed that if I disable prerendering in both WASM and auto-render modes, none of the components are visible until the WASM resources are fully loaded. This seems to contradict the idea that Auto mode should provide interactivity as soon as possible.
I've watched this YouTube video from Steve Sanderson, the creator of Blazor. In the video, it's shown that when a component is loaded for the first time in Auto mode, it's rendered and interactive using a WebSocket connection. From the second refresh, it's loaded via WebAssembly. However, I don't seem to observe this behavior in my tests.
Can anyone clarify how Auto mode is supposed to work in Blazor .NET 8? If it is WASM, just with prerendering, then what's its difference with WASM render mode (as all interactive render modes have prerendering on by default)?