I am extensively using optimistic UI, however, after migrating to 3.x, using forEachAsync() does not always await on the client stub side, e.g.
await colHistoryStacks.find({ songPageDoc_id: songPageDoc_id }).forEachAsync(async (historyStackDoc: tp.HistoryStackDoc) => await clearHistoryStackAsync(historyStackDoc._id, true, true));
next awaited clearHistoryStackAsync() iteration is already started before earlier iteration is finished.
Replacing forEachAsync() by for await(…) does work as expected:
for await (let historyStackDoc of colHistoryStacks.find({ songPageDoc_id: songPageDoc_id })) await clearHistoryStackAsync(historyStackDoc._id, true, true);
The same happens on various similar code blocks in my project.
Is this a bug, or am I missing something?