When I am using two apex Wire Method to Function type, only one wire method is responsive. I am not sure if I am doing it right. Please can anyone help?
@wire(totalApplication)
wireRecord({ error, data }) {
if(data){
this.totalSubcontractApp = data;
this.error = undefined;
}else if (error){
this.error = error;
this.totalSubcontractApp = undefined;
}
};
AND
@wire(partialSubcontractRecord)
wireRecord({ error, data }) {
this.paginationList = data;
this.error = undefined;
}else if(error){
this.error = error;
this.paginationList= undefined;
}
};
Pick different name for your handler function. The "magic" is in @wire
, not in wireRecord
name.
Let's ignore custom handlers of result in JavaScript, forget the whole ({error, data})
and everything after it. Back to basics, to saving result in a variable. Like @wire(getContactList) contacts;
in https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.apex. You wouldn't have 2 methods writing stuff to same variable name and complain only 1 result at a time "works", right?
Call them
@wire(totalApplication) wiredTotalApplication({ error, data }) {...
@wire(partialSubcontractRecord) wiredPartialSubcontractRecord({ error, data }) {...