react-doctor/async-parallel
Use `const [a, b] = await Promise.all([fetchA(), fetchB()])` to run independent operations concurrently
- Category: Performance
- Severity: warn
- Source:
oxlint-plugin-react-doctor - Framework: global
- Enabled when: always
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
The rule fires on three or more consecutive await statements (variable declarations or bare expression statements) in the same block where no later await references an identifier declared by an earlier one. Confirm independence holistically — even if a result isn't read, sequential side effects may matter (DB write ordering, transaction state, rate-limited APIs). Skipped in .test/.spec/.stories files.
Fix prompt
Use this once validation confirms the diagnostic is real.
Combine into Promise.all: const [a, b, c] = await Promise.all([fetchA(), fetchB(), fetchC()]). All three start immediately; total time is max(...) instead of sum(...). If one failure shouldn't abort the others, use Promise.allSettled and inspect each result's status. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all
Related rules
More Performance rules from the rules reference:
react-doctor/client-passive-event-listeners: Add `{ passive: true }` as the third argument: `addEventListener('scroll', handler, { passive: true })`. Only do this if the handler does NOT call `event.preventDefault()` — passive listeners silently ignore `preventDefault()`, which breaks features like pull-to-refresh suppression, custom gestures, and nested-scroll containment.react-doctor/js-async-reduce-without-awaited-acc: Await the accumulator inside an async .reduce reducer: const acc = await previous; ...; return acc;react-doctor/js-batch-dom-css: Batch DOM/CSS reads and writes — interleaving them inside a loop causes layout thrashing. Read first, then writereact-doctor/js-cache-property-access: Hoist the deep member access into a const at the top of the loop body: `const { x, y } = obj.deeply.nested`react-doctor/js-cache-storage: Cache repeated `localStorage`/`sessionStorage` reads in a local variable — each access serializes/deserializes