async-await-in-loop: already-parallel map callbacks reported inside a Promise.allSettled wrapper
A mapped async callback is reported as sequential when its promises are already
started together and passed to a local wrapper around Promise.allSettled.
The wrapper waits for every operation to finish before propagating an error,
which is needed when a transaction must not roll back while sibling work is
still running.
Reproduction environment
React Doctor 0.9.14, Node 24.18.0, macOS. The full CLI scan succeeds with
schemaVersion: 3, ok: true, complete: true, and no skipped checks.
Create package.json:
{"name":"react-doctor-await-repros","private":true,"version":"1.0.0","type":"module","dependencies":{"react":"19.3.0"}}Create src/App.tsx so the fixture explicitly contains a React entry point:
import { createElement } from 'react'
export const App = () => createElement('div', null, 'Rule reproductions')Add the TypeScript file below and run from that directory:
npx --yes [email protected] . --scope full --json --blocking none --yes --no-scoreMinimal source
src/parallel-wrapper.ts:
const waitForAll = async <T>(operations: Array<Promise<T>>): Promise<T[]> => {
const settled = await Promise.allSettled(operations)
const values: T[] = []
for (const result of settled) {
if (result.status === 'rejected') throw result.reason
values.push(result.value)
}
return values
}
export async function runBatch(ids: string[], operation: (id: string) => Promise<void>): Promise<void> {
await waitForAll(ids.map(async (id) => {
await operation(id)
}))
}Actual
react-doctor/async-await-in-loop reports the await at line 13. The message says
“Async callback in .map runs the awaits one after another” and recommends mapping
into Promise.all.
The callback invocations already start synchronously during .map. A deterministic
runtime check starts three operations, holds each on an individually controlled
promise, and observes peak concurrency 3 before releasing any operation.
A separate failure check confirms the wrapper waits for the other operation to
settle before propagating the rejection. Both checks pass under Node 24.18.0.
Expected
Do not describe this mapped callback as sequential. Recognize a provable same-file
settlement wrapper where feasible, or use a conservative diagnostic when the
consumer of the mapped promises is unknown. Replacing this wrapper with
Promise.all would change rejection timing while adding no concurrency.
This is not a request to suppress truly sequential for...of loops, to infer
arbitrary opaque helpers, or to exempt unobserved/unawaited mapped promises.
Existing-report search
No exact report found among open/closed issues and PRs searched for
async-await-in-loop, Promise.allSettled, async callbacks, and Promise.all
wrappers on 2026-09-26. Related PR #1521
concerns ordered shared-receiver loops; this case is an already-parallel map.
The fixture is independent of application code and contains no private data.
Source: millionco/react-doctor