1

i'm trying to set a list of string to an aura:attribute and i get this error:

Uncaught rerender threw an error in 'markup://aura:expression' [info.$component$.$isValid$ is not a function]

that's the attribute:

<aura:attribute name="parents" type="String[]"/>

i call this function in js:

test: function(component){
    var action = component.get("c.test");
        //Set up the callback
        var self = this;
        action.setCallback(this, function(actionResult) {          
        debugger;
            component.set("v.parents", actionResult.getReturnValue());
        });        
        $A.enqueueAction(action);  

}

and thats the function:

@AuraEnabled
public static List<String> test(){
    String[] a = new String[]{};
    a.add('1');
    a.add('2');
    return a;
}

please help Thanks

3
  • Are you sure you are getting the error in this code only? May 16, 2017 at 8:53
  • @itzmukeshy7 yes, it only occures when i call this function
    – Dana Griff
    May 16, 2017 at 9:20
  • Think this might be due to non-use of an iterator in the component markup. See my answer. May 16, 2017 at 9:41

1 Answer 1

1

EDIT

How are you displaying this string array? If you are trying to display it directly without an iteration component, then you can get this error.

Add an iteration on the String[] and see if that fixes it.


This error is probably because you have the same name defined in the Apex controller and the Javascript controller code.

Change the Javascript method name to something else - eg from test to testJS and this error is likely to go away.

This sort of error causes recursion, which can lead to component invalidation errors like you are getting.

2
  • nope, still an error
    – Dana Griff
    May 16, 2017 at 9:20
  • Any luck with my updated answer? May 16, 2017 at 17:25

You must log in to answer this question.

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