0

I'm trying to use the new RefreshView API introduced in Spring '23 to fire a refresh event from an Aura component to refresh a related list wire in an LWC component (very similar scenario to this Force refresh of getRelatedListRecords).

Here's the wire and refreshHandler in the LWC component that I'm trying to get refreshed data in:

refreshHandler() {
    refreshApex(this.allocationRecords);
}

@wire(getRelatedListRecords, {
    parentRecordId: '$recordId',
    relatedListId: 'Investment_Allocations__r',
    fields: ['Investment_Allocation__c.Type__c','Investment_Allocation__c.Subtype__c']
})listInfo({ error, data }) {
    if (data) {
        this.allocationRecords = data.records;
        this.error = undefined;
    } else if (error) {
        this.error = error;
        this.allocationRecords = undefined;
    }
}

The problem is that I'm never hitting the refreshHandler method. I'm firing the refresh event from an Aura component, and there is no documentation around using the RefreshView API in Aura. Here's what I'm doing in my Aura component after the allocation data has been updated via Apex:

this.dispatchEvent(new RefreshEvent());
2
  • Have you tried just using force:refreshView directly from Aura? They should be linked together, I believe.
    – sfdcfox
    Mar 30, 2023 at 17:41
  • @sfdcfox Just tried that out and still am not hitting the refreshHandler in my LWC or getting refreshed data, unfortunately. Mar 30, 2023 at 17:49

0

You must log in to answer this question.