ScriptBodyEditor's onChange fired when the value prop changed externally (from handleAcceptCandidate inserting placeholders), creating a feedback loop that reset acceptingCandidateRef before the second useEffect cycle. Guard onChange to only propagate when the value actually differs from the current prop. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>