Inaccurate Deprecation Message for LWC refreshApex

Issue #2148 duplicate
Thomas Hajcak created an issue

The LWC method refreshApex is flagged as deprecated because part of the functionality is being deprecated in the future. If you’re currently using this method in the way in which it will not be deprecated (which I believe amounts to calling an Apex function) it gives the false impression that this is incorrect or going away.

I’m not even sure how you could consider correcting this since the functionality is only being partially deprecated, but it has bad optics in the code for valid use cases. It might be better to not flag this as a deprecated function.

In the example below, a valid future use case for refreshApex, reach reference to the method has a strikethrough and the deprecation message when hovered.

import { api, LightningElement, track, wire } from "lwc";
import processRequest from '@salesforce/apex/PceRequestFormController.processRequest';
import { refreshApex } from "@salesforce/apex";

export default class PceRequestForm extends LightningElement {
  @track contactDetails;

  @wire (getContactDetails, {contactId: '$recordId'})
    wiredContact(value) {
      this.contactDetails = value;
    }
  }

  createPceRequest(isCustom, selectedEmail) {
    refreshApex(this.contactDetails);
  }
}

Comments (1)

  1. Log in to comment