I am getting below error when imperative method return null values.
Error :Cannot add property 0, object is not extensibleCannot add property 0, object is not extensible
name=[];
callaccountName(){
getaccountList().then(data => {
this.name = data;
})
}
1 Antwort
Hi Kishore,The response from apex might have become non-extensible with additional parameters.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensionsAs workaround you can use result = Object.assign({}, result) for objects, or item = Object.assign({}, item) in a loop for each item in result for arraysOr one more dirty hack is JSON.parse(JSON.stringify(result));I hope this helps and in case if this comes in handy can you please choose this as best answer so that it can be used by others in the future.Regards,Anutej