Thanks again @AdrianAkbariNet4s . I think you are correct. And my code is working now! Here's a snippet of my <DataSourceComponent>
<DataSourceComponent
useDataSource={useDataSource}
query={dataSource ? query : null}
widgetId={this.props.widgetId}
onDataSourceCreated={this.onDataSourceCreated}
onDataSourceInfoChange={this.onDataSourceInfoChange}
onCreateDataSourceFailed={this.onCreateDataSourceFailed}
>
{this.renderChild}
</DataSourceComponent>
this.renderChild is called whenever there is a selection update on the data source, made by any other widget, including OOTB ones.
This is the only thing I'm storing in the sate when the onDataSourceInfoChange is called:
onDataSourceInfoChange = (info: IMDataSourceInfo) => {
this.setState({
dataSourceStatus: info.status,
dataSourceWidgetQueries: info.widgetQueries,
dataSourceVersion: info.version
})
}