5

The aura framework and lightning:recordData currently (Summer 18) support only single object retrieval.

Let's assume I got a listItem.cmp into which I wired force:recordData in VIEW mode or a lightning:recordViewForm

Is the following code, then, a good idea or a bad idea and why?

<aura:iteration items="{!v.listOfRecordIds}" var="recordId">
    <c:listItem recordId="{recordId}"/>
</aura:iteration>

Does the answer change if I use forms of the Lightning Data Service that also support record updates?

5

You'll want to look at this answer regarding force:recordData performance, which lightning:recordViewForm depends on. Basically, doing this is going to generate a ton of traffic and perform very poorly if you're dealing with more than about six records. So, if you expect to have only a handful of records, knock yourself out and use the lightning:record* elements.

However, if you expect to have a significant number of elements, you're better off writing some Apex Code to get the results back. You'll have to evaluate if the performance trade off is worth it.

Also, I might add, that a FULL layout, if you choose to use it, results in about 500k of data being transferred per record, which means that even if it looks okay on a desktop/laptop, mobile devices are going to chew through metered data like an unattended child does candy while Trick-or-Treating.

|improve this answer|||||
  • 1
    The FULL options transports Userinterface API data (Layouts, Field Info, RecType Info) - just to avoid the impression that 'full' is just bloated. I do hope we can soon access this information programmatically. I agree with your assessment that especially for iterations this is too much unnecessary data. – Christian Szandor Knapp Jul 12 '18 at 17:30
  • @ChristianSzandorKnapp Yep, it's the ui-api. Everything you need to render a record correctly. – sfdcfox Jul 12 '18 at 18:07

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.