All 35 Bugs /
0/35 Fixed ✓
ReactMedium~12 min

Infinite Effect Re-Render Loop

What's Broken (Symptom)

Because `scheduleEffect` omits its dependency array, every state update triggers another render and runs the fetch effect forever (hitting the 20-render guard).

Expected Behavior

  • Pass proper dependencies (`[userId]`) to `useEffect(fn, deps)` instead of omitting deps (`undefined`).
  • Mounting `{ userId: "u1" }` triggers exactly **1** fetch (`fetchCount === 1`) without hitting an infinite loop.
  • Updating `userId` to `"u2"` triggers cleanly a second time (`fetchCount === 2`).

Debugging Hints (0/2 used)

Try spotting the bug in the editor first. Need a nudge? Reveal Hint 1 anytime.

Root Cause Breakdown

Pass all 3 automated verification checks on the right to unlock the full Root Cause explanation.

Automated Bug Verification

3 Checks Ready
  • Breaks infinite render loop on initial mountMount renders settle in <= 3 cycles and call fetch exactly once.
  • Updates state cleanly with fetched profile objectLatest state matches userId u2 after prop change.
  • Supplies explicit dependency array to hooks.useEffectuseEffect second argument must be an array.
bugfix.js
Live Sandboxed PreviewCtrl + Enter to verify
Console Output0 log(s)
No console output yet. Run Preview or Verify Bug Fix.