2

In the code bellow, the third parameter is a promise, that when resolved (or rejected) will execute a callback function.

There we receive a "Maximum call stack size exceeded" when Locker service is active.

var dataService = {
request : $A.getCallback(function(actionName, params, defer) {

    var componentActionName = 'c.' + actionName;
    var action = component.get(componentActionName);

    action.setParams(params);

    action.setCallback(this, function(a) {
        try {

            var state = a.getState();
            if (state === 'SUCCESS') {
                defer.resolve(a.getReturnValue());
            }
            else if (state === 'ERROR') {
                var errors = a.getError();
                if (errors) {
                    defer.reject(errors[0].message);
                } else {
                    defer.reject('Lightning server side unknown error');
                }
            }
        } catch (ex) {
            console.log('### Exception: ');
            console.log(ex);
        }
    });

    $A.enqueueAction(action);

})

Any idea what might be going on?

1
  • Just an observation, you seem to be storing the result of $A.getCallback in an object which is not recommended in the developer guide: "Don't save a reference to a function wrapped in $A.getCallback(). If you use the reference later to send actions, the saved transaction state will cause the actions to be aborted." I don't know if that could be part of the problem or not.
    – Charles T
    Commented Jun 30, 2016 at 13:58

1 Answer 1

0

This has been fixed by Salesforce on SUMMER '16 PATCH 7.0

More details:

https://success.salesforce.com/issues_view?id=a1p3A000000jkqqQAA

You must log in to answer this question.

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