-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
[Symptoms]
When InteractiveWebAssembly is specified in the razor component created on the Client Project side, the initial processing is executed on the server side.
[Problems caused by this]
If HttpClient is @Inject on the WASM razor component, runtime will try to inject the server-side HttpClient on the first operation. An exception occurs when HttpClient is registered only on the WASM Client project side.
This behavior is reasonable if we use InteractiveAuto, but I suspect this is a bug when using InteractiveWebAssembly. (Maybe it is by-design, but it is very confusing.)
Expected Behavior
[Expected behavior]
When InteractiveWebAssembly is specified in the razor component created on the Client Project side, all processing is executed on the browser side.
Steps To Reproduce
No response
Exceptions (if any)
[Workaround]
It can be avoided by disabling prerendering by specifying below. However, the settings are very roundabout.
@rendermode InteractiveWebAssemblyWithoutPrerendering
@code {
static IComponentRenderMode InteractiveWebAssemblyWithoutPrerendering = new InteractiveWebAssemblyRenderMode(prerender: false);
}
or
@Attribute [RenderModeInteractiveWebAssembly(prerender: false)]
(I've heard that this is not deprecated in GA.
[Suggestion]
- Create a non-prerendering option in the RendorMode enumeration (such like InteractiveWebAssemblyWithoutPrerendering)
- It would be nice to have a way to disable prerendering globally
.NET Version
No response
Anything else?
No response