I've seen quite a few Lightning Data Services posts pop up recently. This question used it to work on a set of records as opposed to a single record. The way it was coded had me worried thinking that it may be terribly inefficient when working on sets of records:
Troubling code sample:
<aura:iteration items="{!v.contactIds}" var="contact">
<c:ContactComponent contactId="{!contact}"/>
<hr/>
</aura:iteration>
It passes an ID to a sub component that then uses LDS to retrieve and display the record details to the page. To me, this is the equivalent of a SOQL query in a for loop.
The question is, how accurate is this assumption? Would it be more efficient to use APEX to retrieve the records via a single query as opposed to LDS for each record individually?
The documentation here seems to support my concern with it's brief explanation of the LDS:
At the simplest level, you can think of Lightning Data Service as the Lightning Components version of the Visualforce standard controller.
It's being compared to the standard controller, not the standard set controller.
I'm just curious if anyone has put this to the test.