Hopefully this is a simple typo somewhere that I just can't find, but I have a very simple LWC in a community to just get some record data, and the getRecord wire adapter isn't executing as recordId gets its data.
edit: To add some clarification, the wire adapter is firing once, when recordId is undefined, but is not being fired a second time when recordId gets set.
@api recordId;
wiredRecord;
@track record;
@wire(getRecord, { recordId: '$recordId', fields: recordFields})
handleWiredRecord(result){
this.wiredRecord = result;
console.log(result);
const {error,data} = result;
if (error){
console.warn(error);
} else if (data){
console.log(data);
this.record = data;
}
}
connectedCallback() {
console.log(this.recordId);
}
The output to the console is { data:undefined , error:undefined }
, which is coming before the recordId output of the connectedCallback (which is working by the way)
I configured everything in the community and component correctly in that the recordId is coming through, however, the wire adapter runs before the recordId exists, and is not running again when it is populated.
Any help is appreciated.
console from above code:
{ data:undefined , error:undefined }
<recordId> // came through correctly
@wire(getRecord, { recordId: '$recordId', fields: recordFields}) wiredRecord;
and then using just thethis.wiredRecords.data
$_recordId
, but that also didn't cause any update when the value became available