+ Start a Discussion
mohd areeb 8mohd areeb 8 

This Error is coming “Cannot add property count, object is not extensible” while running LWC

async connectedCallback() {
    this.isLoaded=true;
    await this.ScrollToTop();
    let result = await getLocationwithKeys({});
    this.LocationAllData =await this.filterCountData(result);
    console.log('this.LocationAllData....' + JSON.stringify(this.LocationAllData));
    this.isLoaded=false;
}

async filterCountData(result) {
    for (let i = 0; i < result.length; i++) {
        let count = 0;
        if (result[i].VFD_Datas__r)
            count = count + result[i].VFD_Datas__r.length;
        if (result[i].Existing_Keys__r)
            count = count + result[i].Existing_Keys__r.length;
        if (result[i].Refrigeration_Data_Tables__r)
            count = count + result[i].Refrigeration_Data_Tables__r.length;
        if (result[i].Add_Sensors_Data__r)
        count = count + result[i].Add_Sensors_Data__r.length;
        result[i].count = count;
        if(count>0){
            result[i].showrecordy =true;
        }
    }
    return result;
}