5

I'm developing a Lightning Component at work. Basically, everything was going well until I activated the LockerService.

I have some parts in the app that when I fire an event, another component handles it and updates an attribute list that it has defined.

For example in the below code, you can see a function in a helper class of the handler component that use to work fine:

        var unallocatedPlayers = cmp.get("v.unallocatedPlayers");
        for(var i = unallocatedPlayers.length - 1; i >= 0; i--) {
            if(unallocatedPlayers[i].Id === idTournamentEntryAllocated) {
               unallocatedPlayers.splice(i, 1);
            }
        }

        cmp.set("v.unallocatedPlayers", unallocatedPlayers); 

It receives an ID and it looks for an element in a list with that ID, if it's found then it's removed from the list, the screen will have one element less in one table.

The last line (when it sets back the attribute) uses to trigger a refresh in that component so the list had one element less in this case but it is not doing that anymore.

When I debugged the list, it contains one element less and it's been set in that property but the "refresh" is not done so the user still is able to see that element in that table.

The component that has the handler:

<aura:component controller="ManageDrawCtrl" access="public">
<aura:attribute name="unallocatedPlayers" type="Object[]" access="public"></aura:attribute>
<aura:attribute name="unallocatedPlayersFiltered" type="Object[]" access="public"></aura:attribute>
<aura:attribute name="name" type="String" access="public"></aura:attribute>

<aura:handler event="c:ManageDrawAllocatedPlayer" action="{!c.handleTournamentEntryAllocated}"/>
4

This issue with arrays has been fixed in the next patch for Summer'16 scheduled to be deployed Tuesday/Wednesday of next week.

  • Thanks so much Doug, I thought something was wrong in my code since this is the first complex Lightning Component that I built. Do you know any workaround? – Gustavo Vidal Jun 10 '16 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.