Will It Vibe logoWill It Vibe?
REACT-026Medium severity-8 points

async function passed directly to useEffect

Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 8 points from that category, once per scan, no matter how many places it turns up.

What it detects

An async effect callback returns a Promise, but React expects the callback to return either nothing or a cleanup function. The Promise is ignored, cleanup never runs, and errors go unhandled. Define an async function inside the effect and call it instead.

Why it matters

Passing an async function directly to useEffect is a bug because an async function returns a Promise, but React expects the effect callback to return either nothing or a cleanup function. React ignores the returned Promise, so any cleanup you meant to provide never runs, and errors thrown inside are unhandled rejections.

How to fix it

Keep the effect callback synchronous and define an async function inside it, then call that function. Return a real cleanup function from the effect if you need one. Use an abort flag or AbortController to ignore results after unmount.

The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing

Does your repo trip this check?

Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.

Scan your repo

Related Code Quality & Syntax checks