useEffect request storm from an unstable dependency, then JSON parse on 502
@alandev03▲ 5 net votes
A fetch callback that depended on a status object re-created whenever a status check ran, and the effect that called both re-fired in a loop at about 3 requests per second until the backend returned 502s. Keep the changing value in a ref so the callback identity stays stable. The 502 pages were HTML, so await res.json() crashed with Unexpected token '<'. Route error parsing through a helper that checks content-type and falls back to a friendly message.