I am fetching the data from apex class into Aura component controller and in callback action, i am doing

 var effectiveFromDate = "";

            var effectiveFromDateMonth = "";
            var effectiveToDateMonth = "";

            for (var i=0;i<contacts.length;i++) {

                effectiveFromDate = response.getReturnValue()[i].ServiceContact__r.EffectiveFromDate__c;

             effectiveFromDate = new Date(effectiveFromDate);
             effectiveFromDateMonth = effectiveFromDate.toString().split(" ")[1];
            // Months use 0 index.
            effectiveFromDate =  effectiveFromDateMonth+  ' ' + effectiveFromDate.getDate() + ',  ' + effectiveFromDate.getFullYear();

            component.set('v.listOfContacts[' + i + '].ServiceContact__r.EffectiveFromDate__c',effectiveFromDate); 


So when i run this code it gives me warning, number of times this for loop runs.but the error goes when i comment

component.set('v.listOfContacts[' + i + '].ServiceContact__r.EffectiveFromDate__c',effectiveFromDate);

This is the warning:

WARNING: Performance degradation: Multiple items were set in iteration in the same aura cycle

Can anyone help me on this? How to get rid of warnings?

  • What's the warning?
    – sfdcfox
    Dec 13, 2016 at 20:23
  • is this a performance degradation warning in console?
    – Pavlonator
    Dec 13, 2016 at 20:29
  • Yes, it is coming console. WARNING: Performance degradation: Multiple items were set in iteration in the same aura cycle.
    – Coder
    Dec 14, 2016 at 13:40
  • What does your markup look like? Do you have a ui:iteration component where the items property is set to v.listOfContacts? Dec 15, 2016 at 3:18
  • I figured out why it is coming, as i have one iteration in javascript function which is setting the attributes directly proportional to number of times loop runs.If i comment that "component.set" part warning disappears. But, unfortunately i can not comment that thing. @TrevorBliss please let me know if you still need to see code :) . Thanks in advance
    – Coder
    Dec 15, 2016 at 13:41

1 Answer 1


The performance degradation warning happens when you update the aura:attribute that your aura:iteration is iterating over (the items attribute) multiple times in the same cycle. Instead of calling cmp.set() inside your loop, try grabbing the attribute via cmp.get() and fully modify that object before setting it back on the markup.

Here's a simplified example. Try adapting this pattern to your code:

var items = cmp.get("v.listOfContacts");
for (var i = 0; i < contacts.length; i++) {
    items[i].data = contacts[i].data
cmp.set("v.listOfContacts", items);

You must log in to answer this question.

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