Sorry for not being clear.
Unfortunately I can not replicate the problem on the demo page, because I need to modify the Dialog-component and not the compoment opening the Dialog.
But to replicate the issue just add this to any Dialog-component in Version 4.23.2:
int i = 0;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
i = i++;
}
}
You will see that when the Dialog is completly loaded i=2 while normally it should be 1.
Hope that clears it up.
Let's look at the first example "Open page as a dialog":
The DialogService opens the "DialogCardPage". To replicate the issue I would need to edit this "DialogCardPage".
If you add
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
...
}
}
to "DialogCardPage" and replace "..." you should notice that whatever you execute there will be executed twice because "OnAfterRenderAsync" gets triggerd at least twice and bool firstRender is true 2 times while it must only be true 1 time.
I initially updated the NuGet-package to 4.23.2 and the described problem appeared.
I then downgraded to 4.23.1 and the problem was gone.
I opened this topic and after your last reply I confirmed this by running the local demo and it also worked fine.
I now updated the NuGet-package to 4.23.2 again and the problem did not reappear.
I don't know what caused this as I did not alter my code at all, but I am happy it works now.
in the blazor Server with version [4.26.1]. I use the foreach loop to go through a list of reference. Would you please let me know to fix the problem. Thanks!