function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Luke Higgins 23Luke Higgins 23 

LWC Tree Grid returning error on filter change

I have a lightning-tree-grid with a filter. When I initially select a value in the filter, it works fine. However, when I change the filter to a new value, the previously pulled records remain in the list. I get the error -
"Uncaught (in promise) TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'. at HTMLTableSectionElement.removeChild"
I also want to note that this lwc works perfectly in the test environment. I'm only running into this issue in production.

<lightning-record-edit-form object-api-name="Internal_Requirement__c">
   <lightning-input-field name="division" field-name="Division__c" onchange={handleValueChange4} value={division}> </lightning-input-field>
</lightning-record-edit-form>
<lightning-tree-grid
   columns={gridColumns}
   data={treeItems}
   is-loading={isLoading}
   key-field="Name"
   hide-checkbox-column = true
></lightning-tree-grid>
js
@wire(getReqs, {division:'$division'})
    wiredReqs(value){
        console.log(value);
        this.wiredActivities = value;
        const { data, error } = value;
        if (data) {
            var tempjson = JSON.parse(JSON.stringify(data).split('items').join('_children'));
            this.treeItems = tempjson;
            this.isLoading = false;
        }
handleValueChange4(event) {
    this.division = event.target.value; 
}
apex
@AuraEnabled(cacheable=true)
    public static List<IntReqWrapper> getReqs(String division, String region, String year, String quarter){
        List<Internal_Requirement__c> irList = new List<Internal_Requirement__c>();
        String query = 'SELECT Name, Id, Quarter__c, Year__c (SELECT Full_Name__c FROM Internal_Candidate_Submission__r) FROM Internal_Requirement__c WHERE Status__c = \'Open\' ';
            if(division != ''){
                query += ' AND Division__c = \''+division+'\' ';
            }     
        query += ' ORDER BY Name ASC';
        System.debug('q= '+query);
        irList = Database.query( query );
       
        List<IntReqWrapper> irwrap = new List<IntReqWrapper>();
        for(Internal_Requirement__c ir : irList){
            IntReqWrapper irWrapper = new IntReqWrapper() ; 
            irWrapper.ReqId = ir.Id ;
            irWrapper.Name = ir.Name ;
            irWrapper.Quarter = ir.Quarter__c;
           List<Items> co = new List<Items>();
           for(Internal_Candidate_Submission__c ics : ir.Internal_Candidate_Submission__r){
               Items icsWrapp = new Items();
               icsWrapp.FullName = ics.Full_Name__c ;                             
               co.add(icsWrapp);
           }
           irWrapper.items = co;
           irwrap.add(irWrapper);            
        }
        return irwrap;
    }
Abdul KhatriAbdul Khatri
Hi Luke,

One issue I see in your SOQL Query with comma missing after Year__c

String query = 'SELECT Name, Id, Quarter__c, Year__c, (SELECT Full_Name__c FROM Internal_Candidate_Submission__r) FROM Internal_Requirement__c WHERE Status__c = \'Open\' ';

 
Luke Higgins 23Luke Higgins 23
The original Apex class was fairly long so I tried to cut it down. Must have missed that when trimming the fat down.
Abdul KhatriAbdul Khatri
Hi Luke,

The part of the code you shared seems ok to me. I am not sure if anywhere else it is breaking.