I have a wire service that brings back a listing of records. I also have a "New" button on the LWC which uses a child component with a record-edit-form. I send an event that bubbles up to the parent after saving a new record and in the parent method I refresh apex. This works fine unless there are no records and I am adding the first record. The wire service does not get fired and the new record does not show up in my list until I refresh the page. Any suggestions on making this work when I'm creating my first record? thanks!!

  • Please provide some snippets with source code to clarify your problem.
    – gpoluch
    Jul 30 '21 at 21:12

A cheat that should work is by passing a reactive parameter to your wired method. Lets say, the method which is decorated by wire take a parameter number of records rendered

export default class ReactiveWiredApexDemo extends LightningComponent {
  recordsRendered = 0;
  @wire(getRecords, { recordsRendering: '$recordsRendered' }
  getWiredRecords(response) {
    this.records = response;
    this.recordsRendered = response?.data?.length || 0;

  handleRefresh(event) {
    // this will be called when child's event is received
    this.recordsRendered = 1 + this.recordsRendered;

Because of the '$' symbol, every time the recordsRendered changes, getRecords will be called.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.