I have a simple LWC component that isn't able to perform getRecord. As in the situation in this question, I need it to be invoked in a quick action, so it's wrapped in an aura component (if that matters). Here is the js:
import { LightningElement, api, wire } from "lwc";
import { getRecord } from "lightning/uiRecordApi";
const oppFields = ["Opportunity.Name"];
export default class testOPP extends LightningElement {
@api recordId;
// Fetch fields of current opportunity.
@wire(getRecord, { recordId: "$recordId", oppFields })
opp;
renderedCallback() {
console.log("in callback");
console.log("recordId: " + JSON.stringify(this.recordId));
console.log("Opp: " + JSON.stringify(this.opp));
console.log("Opp data: " + JSON.stringify(this.opp.data));
}
}
And here is the markup:
<template>
In my template
Record Id is : {recordId}
<br />
<template if:true={opp.data}>
{opp.data.fields.Name.value}
</template>
</template>
The console shows that recordId is getting populated, but the renderedCallback is only called once. I thought it was supposed to be called several times until the data is pulled down. Here is the console log:
in callback
recordId: "006M000000MGcpvIAD"
Opp: {}
Opp data: undefined
Thanks in advance for any thoughts!
- Randy