I'm receiving a WARNING: Performance degradation: Multiple items were set in iteration message. This occurs in the code below when the aura:if element is there, but not when it isn't.

Each group contains a list of "entries". I simply want to hide the entire group and associated markup (more has been removed for clarity) when there are no entries for that group.

<aura:iteration items="{!v.groups}" var="group">
    <span> <!-- Workaround for a bug in Lightning, leave this tag around the :if -->
        <aura:if isTrue="{!group.entries.length > 0}">
            <aura:iteration items="{!group.entries}" var="entry">

The attributes are only being set once, which seems to be verified by the fact that this error only occurs when the aura:if is involved. This makes me think that it is something to do with the interaction between the :if and the :iteration. Is anyone aware of the cause of this or how to fix it?

2 Answers 2


It turns out that using an :if in an :iteration is not recommended. From the salesforce developer documentation:

Here are some use cases where you should consider alternatives to <aura:if>:

You need to nest conditional logic or use conditional logic in an iteration

It is stated that this is for performance reasons, which echoes the warning being given.

An alternative method, such as hiding the elements via CSS, is recommended. Note that class="{! expr ? 'class1' : 'class2'}" works and so aura:if can be avoided in this way.


If you open the browser console, u'll see that SFDC CRM application code itself triggers lots of

     "WARNING: Performance degradation: Multiple items were set in iteration" 

, so I think it's not an important warning -> can be ignored :)

For example, such warning is triggered each time you click on a tab 'dropdown arrow', which is 100% SFDC code.

You must log in to answer this question.

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