Create and use the OnParametersSetAsync task in your code block for the page. This event will fire when parameters change.
@code
protected override async Task OnParametersSetAsync()
{
// This event will fire when the parameters change
// Put your code here.
}