3

I am getting this warning in my aura iteration after salesforce spring release 16. How can i fix this?

I am constructing json object "tabledata" in a function and populating the table body with "dat" attribute. Exactly when this line of code from my controller runs it throws

"WARNING: Performance degradation: Multiple items were set in iteration in the same Aura cycle." a warning in console. component.set("v.addedObj", tableData);

<table class="slds-table slds-table--bordered slds-max-medium-table--stacked-horizontal slds-no-row-hover">
<thead>
    <tr>
        <th class="slds-text-heading--label slds-size--1-of-6 slds-is-sortable" scope="col">a</th>
        <th class="slds-text-heading--label slds-size--1-of-6 slds-is-sortable" scope="col">b</th>
        <th class="slds-text-heading--label slds-size--1-of-6 slds-is-sortable" scope="col">c</th>
        <th class="slds-text-heading--label slds-size--1-of-6 slds-is-sortable" scope="col">v</th>
        <th class="slds-text-heading--label slds-size--1-of-6 slds-is-sortable" scope="col">p</th>
        <th class="slds-text-heading--label slds-size--1-of-6 slds-is-sortable" scope="col">m</th>
    </tr>
</thead>
<tbody>
<aura:iteration items="{!v.addedObj}" var="dat" indexVar="index">
<tr class="slds-hint-parent">
<td>
    <span class="slds-truncate"><ui:outputText value="{!dat.dat1}"/></span>
</td>
<td>
    <span class="slds-truncate"><ui:outputText value="{!dat.dat2}"/></span>
</td>
<td data-label="allocationPercent">
    <span class="slds-truncate">
      <input type="text" id="{!'a_'+index}" value="{!dat.dat3}" onchange="{!c.updateChanges}" onkeyup="{!c.allocationTotalCal}" onkeydown="{!c.allowNumericWithDecimal}" onblur="{!c.allocationTotalCal}"/>
    </span>
</td>
<td data-label="lowerBand">
    <span class="slds-truncate"><input type="text" id="{!'lBand_'+index}" onkeyup="{!c.onkeyupAllowNumericWithDecimal}" onkeydown="{!c.allowNumericWithDecimal}" onblur="{!c.onBlurBand}" value="{!portfolioData.dat4}"/></span>
</td>
<td data-label="upperBand">
    <span class="slds-truncate"><input type="text" id="{!'uBand_'+index}" onkeyup="{!c.onkeyupAllowNumericWithDecimal}" onkeydown="{!c.allowNumericWithDecimal}" onblur="{!c.onBlurBand}" value="{!portfolioData.dat5}"/></span>
</td>
<td data-label="deleteSym">
    <span id="{!'del_'+index}" onclick="{!c.deleteRow}"> Delete Icon</span>
    </span>
</td>

1
  • looks like {!v.addedObj} contains so many records.
    – Ratan Paul
    Commented Feb 25, 2016 at 4:04

3 Answers 3

1

Looking into aura framework source code you can see this warning is thrown when framework is doing it's own garbage collection.

If a single not-rendered component is destroyed, then framework will show you a warning. Commit message says it's been implemented to stop memory leakage.

Framework executes this cleanup after each update to the DOM.

0

In your function v.addedObj is getting set multiple times. Try setting it to empty array at the start of function.

-1

@Ratan i found the issue,i am trying to set the attribute twice. :)

1
  • 1
    Priya can you pls add your part of code where you are trying to set the attribute twice? So it will be more helpful and make sense.
    – Ratan Paul
    Commented Feb 26, 2016 at 17:08

You must log in to answer this question.

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