The behaviour I was experiencing was that the ConfigurePizzaDialog just was not showing after I click on a Special.
I started going crazy with Console.WriteLine statements to understand what is happening, like so:
The bottom div displayed in the UI, but it always just displayed "No pizza selected".
Correspondingly, ConfigurePizzaDialog never shows, because showingConfigureDialog stays false.
Eventually I added StateHasChanged() as the last line of my ShowConfigurePizza() method, and only then did the display get updated when I click on a pizza special.
Why is this? What am I missing? I'll leave the StateHasChanged() call there for now, but I don't understand why it is needed when it is not in this tutorial's code? I must be missing something?
I got stuck for a lo-o-o-o-ng time on this step: https://github.com/dotnet-presentations/blazor-workshop/blob/main/docs/02-customize-a-pizza.md, at the point of the first Run of the solution in that step, here:
The behaviour I was experiencing was that the ConfigurePizzaDialog just was not showing after I click on a Special. I started going crazy with Console.WriteLine statements to understand what is happening, like so:
All the above Console.WriteLine statements would display, but the UI just did not show the ConfigurePizzaDialog.
In the markup, I also added this to see what's happening:
The bottom div displayed in the UI, but it always just displayed "No pizza selected". Correspondingly, ConfigurePizzaDialog never shows, because
showingConfigureDialog
stays false.Eventually I added
StateHasChanged()
as the last line of myShowConfigurePizza()
method, and only then did the display get updated when I click on a pizza special.Why is this? What am I missing? I'll leave the
StateHasChanged()
call there for now, but I don't understand why it is needed when it is not in this tutorial's code? I must be missing something?