I have a lightning application that is being used in both lightning and classic (via ltng:outApp).
I have a series of callbacks that work perfectly in lightning, but when invoked from classic, the second action.setCallback() callback is never called, and when I monitor action.getstate() it returns "NEW" indefinitely.
Right now, the first call to the "c.getMailingPeriods" controller action works and the data is returned.
Then, the call to "c.getQuoteLines" is called and enqueued, but is never executed and the callback is never called.
If I first call "c.getQuoteLines", then it works and the subsequent action then never gets executed. (I have confirmed the params are all set properly with the correct values)
I have attempted to wrap in $A.setCallback(), without success.
Again, this works in lightning, but in classic the enqueued action never gets attempted to be submitted to the server.
Controller
...
helper.getMailingPeriods(component)
.then(function(mailingPeriods) {
component.set('v.mailingPeriods', mailingPeriods);
// Get quote lines for bundle, with subquery of previously selected NTAs
helper.getQuoteLines(component, quoteId, quoteLineId)
.then(function(quoteLines) {
...
Helper
...
getQuoteLines: function(component, quoteId, quoteLineId) {
return new Promise(function (resolve, reject) {
// Get jobs from controller
var action = component.get("c.getQuoteLines");
action.setParams({
"quoteId": quoteId,
"bundleQuoteLineId": quoteLineId,
});
action.setCallback(component, function(results) {
utils.log('getQuoteLines() results', results);
if(results.getState() === 'SUCCESS') {
utils.log('results:', results.getReturnValue());
resolve(results.getReturnValue());
} else if (results.getState() === 'ERROR') {
utils.log('getQuoteLines() ERROR', results.getError());
$A.log("Errors", results.getError());
reject(results.getError());
}
});
$A.enqueueAction(action);
});
},
getMailingPeriods: function(component) {
return new Promise(function (resolve, reject) {
// Get jobs from controller
var action = component.get("c.getMailingPeriods");
action.setCallback(this, function(results) {
utils.log('getMailingPeriods() results', results);
if(results.getState() === 'SUCCESS') {
utils.log('results:', results.getReturnValue());
resolve(results.getReturnValue());
} else if (results.getState() === 'ERROR') {
utils.log('getMailingPeriods() ERROR', results.getError());
$A.log("Errors", results.getError());
reject(results.getError());
}
});
$A.enqueueAction(action);
});
},
...