I'm trying to retrieve data from Apex using @wire
. However, I do not want to fire this event before renderedCallback()
. This is because I'm receiving a parameter required to fire a wired event which is initially set as undefined. This parameter is not used in HTML.
@api myRecords = [];
@track _myParam;
@api
get myParam() {
return this._myParam;
}
set myParam(val) {
this._myParam = val;
}
renderedCallback(){
console.log("---myParam: " + this.myParam);
}
@wire(getInformation, {param1: this.myParam})
wiredAttachments({ error, data }){
if (data){
this.myRecords = data;
} else if (error){
//do something
}
}
I looked at a similar question but unable to figure it out. Any help is appreciated.