I have @wire method in LWC component which uses the current page 'actionName' and 'recordId', which I want to get it from CurrentPageReference and use in another wire method, but CurrentPageReference wire method called after the other @wire method causing a null reference of actionName and recordId.
@wire(CurrentPageReference) {
getStateParameters(currentPageReference) {
if (currentPageReference) {
this.screenMode = currentPageReference.attributes.apiName != undefined ?
currentPageReference.attributes.apiName.substr(currentPageReference.attributes.apiName.length - 3):
currentPageReference.attributes.actionName;
this.recordId = currentPageReference.attributes.recordId;
}
this.screenMode = this.screenMode == 'new'? 'New' : 'Edit';
}
@wire(getInitialAccountRecords,{action:this.screenMode,recordId:'$recordId'})
Any help appreciated. Thanks