Here accomp_year is a simple array like [2021,2022,2023] etc.
This setup was working on with AC1. But with AC2, below error is thrown in console when both ddPlan and scInfo return NULL.
I tried adding another default to handle this, but it didn't work:
Seeing the stacktrace it is not the data that is null. The _whitelist function has an array check and the code comes into the Array.map. The error is generated on one of the items inside the data array, one of those items is a null value.
Isn't whitelist the default list?
Probably the binding is resolving as undefined or something that is not NULL?
Because I can assure you, there is no data here.. no item inside that can be null either.
You can wrap the expression in a log() for debugging like log(ddPlan.data.accomp_year.default(scInfo.data.plan.accomp_year)). It will still pass the value to the component but also outputs it in the console.
The stacktrace shows that it executes the _whitelist function and then the Array.map. The actual error is when reading the style property from a data item. Seeing that it executes the Array.map it means that the data must have been an array and that one of the items is a null value.
The source code for the _whitelist function:
_whitelist () { // this.props.data is the data passed
return Array.isArray(this.props.data) ? this.props.data.map(item => {
const scope = dmx.DataScope(item, this);
const tagData = {
__dmx: true,
__item: item,
value: String(dmx.parse(this.props.tagValue, scope)),
label: String(dmx.parse(this.props.tagText, scope)),
};
// The error is generated on the next line
if (item.style) tagData.style = item.style; // <<<< ERROR
if (this.props.tagSecondary) tagData.secondary = dmx.parse(this.props.tagSecondary, scope);
if (this.props.tagImage) tagData.image = dmx.parse(this.props.tagImage, scope);
if (this.props.tagClass) tagData.class = dmx.parse(this.props.tagClass, scope);
if (this.props.tagCount) tagData.count = dmx.parse(this.props.tagCount, scope);
if (this.props.tagReadonly) tagData.readonly = !!dmx.parse(this.props.tagReadonly, scope);
return tagData;
}) : [];
},
Have no idea what goes wrong but have added an extra check in the _whitelist function, when there is an item undefined/null it should show a warning in the console and not trigger an error.