NonUnique
HTML renders before/during OnInitializedAsync - Blazor server side (no SignalR)
Hi, I want to use Blazor to return static html with no .NET interactivity so SignalR is disabled.
this is Test.Razor
Task.Delay
would be my real IO call. Issue is that HTML C# portion starts executing before lines is being set. So it errors out on foreach. https://blazor-university.com/components/component-lifecycles/ it's here early in lifecycle.
If I add @if (lines is not null)
it returns properly but does it mean that in backend it keeps redrawing on changing values until OnInitializedAsync
is fully done? If I need to handle each value arriving from async methods as possibly null then I sort of make my code work with no data and on real bad data I wouldn't not get 500 to indicate bad data. For RazorComponentResult in minimal API responses I suppose I could do async methods and pass results as parameters but then all logic is lost from .razor
page.
Now as I think this might enable child/parent communication before returning HTML so it's intended and I should always assume anything IO will be missing initially (to be aware in child parameters or in parent should be covered with if before making render child component)?
Maybe there is some true static server side mode? I'm very new to Blazor but have sense how this would be useful on SPA/SignalR streams.2 replies
Setting response code for SPA static file to 404?
Hi, I have a problem - I need ngsw.config missing file to return 404 instead of SPA 200 with index.html. I tried it setting with OnPrepareResponse but apparently you cannot change status code there? SPA site is hosted on IIS. How can I make non existing file ngsw.config return 404 status code? Startup.cs part (the one if(context.File.Name.StartsWith("ngsw.json"))):
1 replies
Serilog loses List-object- property values when serializing
Anyone know fix to my issue? https://stackoverflow.com/questions/74030184/serilog-loses-listobject-property-values-when-serializing
>Problem: Property List<object> gets destructed into [[[[]],[[]]]].
1 replies