Blazored / Gitter

A Blazor Gitter Client
MIT License
37 stars 14 forks source link

Server-side appears to be broken #86

Open chucker opened 4 years ago

chucker commented 4 years ago

I don't generally use it, but tested it for #85.

I get:

System.InvalidOperationException: JavaScript interop calls cannot be issued at this time. This is because the component is being statically rendererd. When prerendering is enabled, JavaScript interop calls can only be performed during the OnAfterRenderAsync lifecycle method. at Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.BeginInvokeJS(Int64 asyncHandle, String identifier, String argsJson) at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](String identifier, CancellationToken cancellationToken, Object[] args) at Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation[T](String identifier, Object[] args) at Blazor.Gitter.Core.LocalisationHelper.BuildLocalCulture() in …/src/Blazor.Gitter.Core/Services/LocalisationHelper.cs:line 39

It appears changing @(await Html.RenderComponentAsync<App>(RenderMode.ServerPrerendered)) to RenderMode.Server fixes this. But maybe there was a purpose in prerendering?