I'm trying to figure out how Blazor behaves. I'm debugging something but temporarily removing commenting out other codes so as not to be destructed and make sure with what I am observing. The codes looks like this.
<OneComponent @ref="_oneComponent" param1="@varParam1" param2="@varParam2"></OneComponent>
@code {
private OneComponent _oneComponent;
private _objectOne varParam1; // There are values here.
private _objectTwo varparams2; // There are values here as well.
private async Task SaveClicked()
{
if (_oneComponent.OnSaveClicked())
{
// nothing here.
}
}
}
When I run the program, I noticed the OnParametersSetAsync() of <OneComponent/> is being re-run.
My question is, why would the OnParametersSetAsync() is being re-run again eventhough I didn't change any of varParam1, varParam2? Is that what it is? Should it re-run when the program now points to that component after the _oneComponent returns true or false?