π Description
Problem
// β PROBLEMATIC CODE
const userRes = await fetch(https://api.github.com/users/${username});
const userData = await userRes.json(); // No check if response was successful
setProfile(userData);
Issue: The code doesn't check if the HTTP response status is OK (200-299). If GitHub API returns 404 or other error status, .json() will try to parse an error response, causing incorrect data to be set.
Impact: Silent failures, incorrect data display, poor user experience.
Recommended Fix: Add response status validation before parsing JSON.
What browsers are you seeing the problem on?
No response
π Relevant Screenshots (Links)
No response
π Description
Problem
// β PROBLEMATIC CODE
const userRes = await fetch(
https://api.github.com/users/${username});const userData = await userRes.json(); // No check if response was successful
setProfile(userData);
Issue: The code doesn't check if the HTTP response status is OK (200-299). If GitHub API returns 404 or other error status, .json() will try to parse an error response, causing incorrect data to be set.
Impact: Silent failures, incorrect data display, poor user experience.
Recommended Fix: Add response status validation before parsing JSON.
What browsers are you seeing the problem on?
No response
π Relevant Screenshots (Links)
No response