The problem line here looks like this one.
const dataSource = dataSourceId && DataSourceManager.getInstance().getDataSource(dataSourceId);
With the && operator, I think this line is only capable of returning a Boolean value. Try taking out the dataSourceId && part.
const dataSource = DataSourceManager.getInstance().getDataSource(dataSourceId);
You might also need to use a shouldComponetUpdate() function to handle the initial load where the dataSource may not be available yet.
https://www.geeksforgeeks.org/what-does-shouldcomponentupdate-do-and-why-is-it-important/#
GIS Developer
City of Arlington, Texas