Thank you for reaching out to Microsoft Q & A forum.
This behavior is expected when Blazor sets [Parameter] and [CascadingParameter] values multiple times during component rendering and updates.
To prevent FileProcess() from being called repeatedly, it’s best to move the logic to the OnParametersSet() method and check if the value has changed:
[CascadingParameter] private string displayRes { get; set; }
private string _prevDisplayRes;
protected override void OnParametersSet()
{
if (displayRes != _prevDisplayRes)
{
_prevDisplayRes = displayRes;
FileProcess();
}
}
This approach ensures the method runs only when necessary.
If you have found the answer provided to be helpful, please click on the "Accept answer/Upvote" button so that it is useful for other members in the Microsoft Q&A community.