I'm exploring the new Blazor features of .NET 8 and I'm encountering an issue where my component seems to be rendering twice. The issue occurs when I'm using "Stream Rendering" combined with the "Interactive Server Render Mode".
I've simplified my code for clarity:
@attribute [StreamRendering]@rendermode InteractiveServer@if (data == null){<p>Loading...</p>}else{<p>@data</p>}@code { private string? data; protected override async Task OnInitializedAsync() { await Task.Delay(1000); data = "Hello World!"; }}In this code, I expect the "Loading..." text to be displayed initially, and then, after a delay, the text "Hello World!" should replace it. This works, but as soon as the data gets shown, the component rerenders and the loading text gets shown again.
How can I prevent the second rerender?