function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDummySFDummy 

Lightning Component Picklist values duplicating (growing)

In a lightning component when I change value I am rendering values for different picklist. But the second picklist(prepay Buydown Years is adding values instead of re-rendering picklist values 
 pick list values duplicating instead of re-render
When I change values in the field - Fixed_Rate_Period__c 
I want to rerender picklist values. - Prepay_Buydown_Years__c
 
<!-- Prepay Buydown Years -->
          <lightning:select disabled="{!v.isEdgeCase == true ? true : v.loanRecord.LLC_BI__Product__c != v.PermLoanString }" aura:id="PrepayBuydownYears" name="PrepayBuydownYears" label="Prepay Buydown Years" value="{!v.loanRecord.Prepay_Buydown_Years__c}" onchange="{!c.changeRefreshEvent}">

            <option disabled="{!v.loanRecord.Prepay_Buydown_Years__c != null &amp;&amp; v.loanRecord.Prepay_Buydown_Years__c != ''}" value="" selected="{!v.loanRecord.Prepay_Buydown_Years__c == null || v.loanRecord.Prepay_Buydown_Years__c == ''}" >--None--</option>
          
              <aura:iteration items="{!v.Prepay_Buydown_Years__c}" var="item">

                  <!-- Rebate --> 
                  <aura:if isTrue="{!v.loanRecord.Rebate_or_Buydown__c == 'Rebate'}">
                      <aura:if isTrue="{!v.loanRecord.Fixed_Rate_Period__c == '96month'}">
                          <aura:if isTrue="{!v.loanRecord.LLC_BI__Spread__c > 0}">
                              <aura:if isTrue="{!item.value &lt; 4}">
                                  <option text="{!item.label}" value="{!item.value}" selected="{!item.value == v.loanRecord.Prepay_Buydown_Years__c}"/>
                              </aura:if>
                          </aura:if>
                          <aura:if isTrue="{!v.loanRecord.LLC_BI__Spread__c == 0}">
                              <aura:if isTrue="{!item.value &lt; 5}">
                                  <option text="{!item.label}" value="{!item.value}" selected="{!item.value == v.loanRecord.Prepay_Buydown_Years__c}"/>
                              </aura:if>
                          </aura:if>
                      </aura:if>
                      <aura:if isTrue="{!v.loanRecord.Fixed_Rate_Period__c == '36month' || v.loanRecord.Fixed_Rate_Period__c == '12month'}">
                          <aura:if isTrue="{!v.loanRecord.LLC_BI__Spread__c == 0}">
                              <aura:if isTrue="{!item.value &lt; 3}">
                                  <option text="{!item.label}" value="{!item.value}" selected="{!item.value == v.loanRecord.Prepay_Buydown_Years__c}"/>
                              </aura:if>
                          </aura:if>
                          <aura:if isTrue="{!v.loanRecord.LLC_BI__Spread__c > 0}">
                              <aura:if isTrue="{!item.value &lt; 2}">
                                  <option text="{!item.label}" value="{!item.value}" selected="{!item.value == v.loanRecord.Prepay_Buydown_Years__c}"/>
                              </aura:if>
                          </aura:if>
                      </aura:if>
                  </aura:if>
                  
                  <!-- RateBuydown -->
                  <aura:if isTrue="{!v.loanRecord.Rebate_or_Buydown__c == 'RateBuydown'}">
                      <aura:if isTrue="{!v.loanRecord.Fixed_Rate_Period__c == '36month' || v.loanRecord.Fixed_Rate_Period__c == '12month'}">
                          <aura:if isTrue="{!item.value &lt; 3}">
                              <option text="{!item.label}" value="{!item.value}" selected="{!item.value == v.loanRecord.Prepay_Buydown_Years__c}"/>
                          </aura:if>
                      </aura:if>
                      <aura:if isTrue="{!v.loanRecord.Fixed_Rate_Period__c == '96month'}">
                          <aura:if isTrue="{!item.value &lt; 5}">
                              <option text="{!item.label}" value="{!item.value}" selected="{!item.value == v.loanRecord.Prepay_Buydown_Years__c}"/>
                          </aura:if>
                      </aura:if>
                  </aura:if>
                  
              </aura:iteration>

          </lightning:select>
        </div>
Thanks for help
SFDummySFDummy
Hello, Looks like the problem is using aura:if inside the aura: iteration.  I have 5 combinations, how do I make sure I set value and clear the picklist before render. 
aura:iteration
I noticed that  renderif is deprecated - https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_aura_renderIf.htm
Any pointers on how to clear picklist option before loading
 
SFDummySFDummy
looks like this problem is related to having multiple conditions in aura:if in aura: iteration.
deprecated - https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_aura_renderIf.htm
any suggestions, please