Could someone help me why the promise within the promise.all ie ( suggestRC and suggestGL) are not getting called? I would like to make sure the suggestRC and suggestGL are executed concurrently. That was the reason, I had written like this. extractIdeas is getting called but suggestRC and suggestGL are not getting called.
function suggestValues(editIdeaPanel) {
Requests.deckreposvc({searchIdeas: {searchString: searchReq}})
.then(extractIdeas)
.then(Promise.all([suggestRC, suggestGL]))
.catch(handleError);
}
function extractIdeas(searchRes) {
return searchRes.searchIdeas.data;
}
function suggestRC(ideas) {
return new Promise(function(resolve, reject) {
//do something
}
resolve(ideas);
});
}
function suggestGL(ideas) {
return new Promise(function(resolve, reject) {
if(!editIdeaPanel.wdGLeaderCombo.propertyValue.uuid) {
//do something
}
resolve(ideas);
});
}
You need to call those two functions (add parentheses) in a callback that you pass to then
:
.then(data => Promise.all([suggestRC(data), suggestGL(data)]))
Also, you will want suggestValues to return
the promise:
return Requests.deckreposvc( //...etc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.