Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

onParametersSetAsync is being called even though params has not been changed

$
0
0

I'm trying to figure out how Blazor behaves. I'm debugging something by temporarily removing commenting out other code so as not to be destructed and make sure with what I am observing. The code looks like this.

<OneComponent @ref="_oneComponent" param1="@varParam1" param2="@varParam2"></OneComponent>
@code {  private OneComponent _oneComponent;   private _objectOne varParam1;   // There are values here.  private _objectTwo varParam2;   // There are values here as well.  private async Task SaveClicked()  {    if (_oneComponent.OnSaveClicked())    {      // nothing here.    }  }}

When I run the program, I noticed OnParametersSetAsync() of <OneComponent/> is being re-run.My question is, why is OnParametersSetAsync() being re-run again even though I didn't change any of varParam1 or 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?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>