0

Is this common that field data loading in lightning:recordViewForm is having bit delay?

Is there a way we can avoid this delay?

<force:recordData recordId="{!v.recordId}"
                      targetRecord="{!v.record}"
                      targetFields="{!v.simpleRecord}"
                      fields="Id,
                              Name,
                              Track__c,
                              Cohort_Sem__c,
                              Job_Category__c,
                              InternshipWorkSite__c,
                              Site_Location__c,
                              Start_Date__c,
                              Employer__c"
                      />

<div class="Record Details">
    <lightning:card iconName="action:clone" title="Clone Internship">
        <div class="slds-p-horizontal--small"> 
            <lightning:recordViewForm recordId="{!v.simpleRecord.Id}" objectApiName="Apprenticeship__c"> 
                <div class="slds-grid">
                    <div class="slds-col slds-size_1-of-2">
                        <lightning:outputField fieldName="Track__c" />
                        <lightning:outputField fieldName="Job_Category__c" />
                        <lightning:outputField fieldName="InternshipWorkSite__c" />
                    </div>
                    <div class="slds-col slds-size_1-of-2">
                        <lightning:outputField fieldName="Site_Location__c" />
                        <lightning:outputField fieldName="Start_Date__c" />
                        <lightning:outputField fieldName="Employer__c" />     
                    </div>
                </div>
            </lightning:recordViewForm>
                <lightning:button label="Cancel" onclick="{!c.handleCancel}" class="slds-m-top_medium" />
                <lightning:button label="Clone internship" onclick="{!c.handleSaveinternship}"
                                  variant="brand" class="slds-m-top_medium"/>               
        </div>
    </lightning:card>
</div>

enter image description here

enter image description here

3
  • what do you mean by a bit of a delay?
    – glls
    Jan 22, 2018 at 18:53
  • I have this component on a record page as quick action. If I click on the button, the RecordviewFrom is loading after few seconds. I can see that Cancel and Clone Internship buttons appearing before the field data loads.
    – Ajay
    Jan 22, 2018 at 18:56
  • a small delay is normal, and yes, you can add a lightning:spinner to your page
    – glls
    Jan 22, 2018 at 19:03

1 Answer 1

3

Yes, there will be a minor delay, since the fields must be fetched from the server. There's nothing you can do to avoid this delay. The delay should usually be less than a small fraction of a second, enough to be noticeable, but not by much.

6
  • is there way we can add spinner while loading? on specific action we can handle it in javascript and show the spinner, how about on recordviewForm load?
    – Ajay
    Jan 22, 2018 at 19:01
  • @Ajay Yes, you can set a spinner on init, and a change handler on simpleRecord; once it's loaded, hide the spinner.
    – sfdcfox
    Jan 22, 2018 at 19:03
  • Got it. make sense.
    – Ajay
    Jan 22, 2018 at 19:03
  • It is not the LDS delay, it is a delay in recordformview component rendering delay. Not sure why. I just printed the data without recordformview and it worked perfectly fine
    – Ajay
    Jan 23, 2018 at 2:44
  • @sdfcfox can you please post example how to add a change handler on simpleRecord and check it is loaded.. thanks a lot Aug 18, 2018 at 4:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .