I have two individual LWC's on a record page. From one, I can create records that I the second separate LWC to update.

I am able to achieve a refresh for the LWC from which the changes are made. But on the second LWC there is no refresh until done at the browser level I just want the second LWC to make a backend call when returning to the record page so that the updated data shows correctly without a browser refresh

I've tried using refreshApex, the following works in the LWC that I'm creating from but I still need to update the second LWC.

lwc js:

@wire(getTasks, { RecordId: '$recordId' })
    const { data, error } = wireResult;
    this._wiredMarketData = wireResult;
        this.taskList = data
    if(error) {
    //onsuccess call
    handleTaskCreated(event) {
        //set the task id so we can update it with resources later
        this.taskId = event.detail.id;

        //update resources with mission task id

  • 1
    You're using refreshApex incorrectly. Also, remember that this method is asynchronous, so you will want to wait on it (async handleTaskCreated(event) { /* snip */ await refreshApex(this.taskWire). I've linked an answer that should get you most of the way there.
    – sfdcfox
    Mar 10, 2023 at 20:26
  • Well, I figured it out. I used pubsub to call a method on the second LWC and then called refreshapex from that LWC to refresh.
    – mackmama
    Mar 11, 2023 at 15:55