-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I have a Blazor component/page with a Route and Query String (SupplyParameterFromQuery) parameter. When both values change SetParametersAsync is called twice - the parameter/property values are identical on each call.
[Parameter]
public string Name { get; set; }
[Parameter]
[SupplyParameterFromQuery]
public int Count { get; set; }
Expected Behavior
I'd expect SetParametersAsync to be called once as the types of the parameters are non-mutable.
If both parameters are query parameters then SetParametersAsync is only called once.
Steps To Reproduce
Repro project: https://github.com/georgehemmings/BlazorDuplicateSetParams
The project is the a standard Blazor Server template with modifications to Counter.razor
Go to: https://localhost:7243/counter/A?Count=1000
Click "Counter A Add 1"
Then click "Counter B Add 1"
Observe "Current count" changes from 1000 to 1 as expected.
However note setParametersAsyncCalledCount jumps from1 to 3.
Alternatively place a break point on Line 56 of Counter.razor and observe that the parameters are the same for each execution.
Clicking either button repeated only increases setParametersAsyncCalledCount by 1. It's only when switching between the buttons that SetPamatersAsync is called twice.
Exceptions (if any)
No response
.NET Version
No response
Anything else?
.NET 9.0