0

Hi all first attempt at this aura with nested lwc sorry so may be (hopefully) a simple implementation error.

I have a basic lwc component embedded in an aura component. I know the lwc serverside/apex controller is passing a payload back to the lwc because the debug log shows me the payload clearly just prior to returning it to the lwc. RecordId is being passed into lwc from aura fine. Things get weird at the aura component-lwc interface however - the lwc doesnt treat the payload as I'd expect - it treats payload as 'undefined'. What am I missing here?

the aura markup:

<c:activityTimeline recordId="{!v.recordId}"/>

the activityTimeline lwc markup:

<!-- recordId is being passed in fine... -->
<template if:true={payload} for:each={payload.rows} for:item="row">
    <p key={row.rowId}>a row</p> <!-- just want to try to display something! -->
</template>

   

the lwc js:

import { LightningElement, api, wire } from 'lwc';
import getTimelineData from '@salesforce/apex/ActivityTimelineCC.timelineData';

export default class ActivityTimeline extends LightningElement {
@api recordId;
@api activityDate = "2022-09-26";
payload;

@wire(getTimelineData, {activityDate : '$activityDate',
                        recordId : '$recordId' }) 
timeslotData({error,data}){
    if(data){
        this.payload = data;
        // by this point the data is {}, despite the apex debug showing a large payload...
    }
    if(error){
        // no error is being noted here.
    }
};
3
  • That "rowId" sounds like you're passing back a list of helper wrapper class objects. Did you mark every field as @AuraEnabled public{get;set;}? Don't think it has anything to do with being inside aura Commented Sep 26, 2022 at 18:03
  • ...and BOOM! the most obvious thing I couldn't see right in front of me. Thanks Andrew for that lol. Commented Sep 26, 2022 at 21:20
  • Don't worry, bites me in the a$$ at least once a year too :D Glad I could help! Commented Sep 26, 2022 at 21:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.