It appears that when I pass a class as a two-way parameter, that if I replace/update the entire instance of the class that the two-way binding is not activated. The return event to update the source of the parameter is only executed when a property of the class is updated.
For example: my parent component has the following
<DataSourceDatabase @bind-DataSource="@DataSource" IsComponentDisabled="false"></DataSourceDatabase>My child component has the following parameters set:
partial class DataSourceDatabase { [Parameter] public DataSourceModel DataSource { get; set; } = new(); [Parameter] public EventCallback<DataSourceModel> DataSourceChanged { get; set; } I have a server method which will potentially change/set several attributes of the DataSource instance.
When I call that method and set the DataSource to the response this way, the two-way binding will not fire, meaning the instance of the DataSource in the parent component will not get updated:
var validateResponse = await PipelineServer.ValidateSource(request);if (validateResponse.Success){ DataSource = validateResponse.Data}However, if I do the following, then the two-way binding will work and the instance in the parent component will get updated with the current value:
var validateResponse = await PipelineServer.ValidateSource(request);if (validateResponse.Success){ DataSource.DefaultSchema = validateResponse.Data.DefaultSchema;...}My question is, am I missing something?
If not, I hope this helps others