Spent few hours trying to figure out how to run sagas inside a map in parallel.
Tried out what I found : yield result.map(item => call(api.endpoint, item))
But nothing seems to happen.
Here's what I was doing :
export function* syncCanvasesByFolder(<someParams>) {
yield call(api.syncCanvasForFolder, <someParam>);
}
export default function* syncAllFoldersForSurvey(<someParams>) {
// Get list of folder for a survey
const folders = yield call(data.getFolderBySurvey, surveyId);
//For each folder sync canvases
yield all(folders.map(folder => {
call(syncCanvasesByFolder, folder.id, lastSyncedAt, access_token)
}));
/*Sequential call*/
// for (const i in folders) {
// if (folders.hasOwnProperty(i)) {
// yield call(syncCanvasesByFolder, folders[i].id, lastSyncedAt, access_token);
// // yield call(canvasSyncSaga.syncAllCanvasesForFolder, folders[i].id, lastSyncedAt);
// }
// }
}
Sequential call when done in a for loop is working. But nothing seems to happen inside the map. Not getting any exception/errors
as well.
syncCanvasesByFolder
never gets called when I am using map.