Im missing something obvious while trying to add an index property to an array. Can anyone point to why this would be happening? Im gonna cringe when someone points this out, I just know it but Im stuck!
At render I get with this LWC component's @wire target property or method threw an error during value provisioning. Original error: [Cannot read properties of undefined (reading 'settingsWrapper')]
export default class Foo extends LightningElement {
settingsWrapper;
@wire (getEpiStatusSettings)
settings({ error, data}){
if(data){
this.settingsWrapper = [];
data.forEach(function(elem,i){
var clone = Object.assign({}, elem); // this should give me an extensible object
clone.index = i; // want to drop index in here for use later
this.settingsWrapper.push(clone); // seems I cant push to an undefined object?
});
}
};
}
Any pointers would be most appreciated!