[Blazor] Preview9 - MapFallbackToClientSideBlazor unusable with MapBlazorHub() #13742
Labels
area-blazor
Includes: Blazor, Razor Components
feature-blazor-wasm
This issue is related to and / or impacts Blazor WebAssembly
question
Describe the bug
From Preview9, it seem impossible to load a valid application through MapFallbackToClientSideBlazor on a server-side project.
This method expect a filename that can be found in the client-side project, like index.html
But as the new MapBlazorHub does not accept any starting component anymore, like MapBlazorHub() in preview8, the application don't instanciate any App component from the client-side project at startup.
It just keep showing "loading..."
To Reproduce
Steps to reproduce the behavior:
Copy index.html in client-side, and past in the same folder with a name server_index.html, and replace in the file content, the blazor.webassembly.js reference, to blazor.server.js
Launch the server-side app in Debug. It is stuck on "loading..."
Expected behavior
The application should launch normally, as we fallbacked on client-side files.
In my opinion, it is not working because the server-side implementation expect the component declaration in a _Host.cshtml file or similar, to be invoked with the Html helper since the deprecation of MapBlazorHub generic type declaration, but the client-side logic doesn't have any functionnality to cover this behavior at index.html level.
Additional info
I was expecting to use this in order to have a similar startup file when having to switch between client-side and server-side implementations with my BlazorMobile plugin.
This way, being able to use some server-side code for debugging, sharing same html/js/css ressources on each implementations, and also switch easily without thinking between WASM runtime (for iOS, Android, UWP) and .NET Core one (for remote device debugging or Desktop with Electron.NET).
The strategy was only to copy/past the index.html file in server_index.html instead, through a MSBuild task, and replace the blazor.webassembly.js reference to blazor.server.js, and fallback on this file in server-side projects, it was a no brainer.
With this change, the only workaround i found and that i'm working on for the next release for preview9 is:
In my opinion it's a lot of overhead, in order to keep HTML/JS/CSS references synced between the two implementation, as i don't have found any alternative at this moment.
The text was updated successfully, but these errors were encountered: