π Description
// β PROBLEMATIC CODE
const res = await fetch(https://api.github.com/users/${username}/events);
const data = await res.json();
setEvents(data); // No validation - could be error response
Issue: No HTTP status validation. If the response is an error, data will contain an error object with message field, not an events array.
Impact: Runtime errors when trying to iterate over non-array data, application crashes.
Recommended Fix: Check res.ok before parsing JSON and validating response structure.
What browsers are you seeing the problem on?
No response
π Relevant Screenshots (Links)
No response
π Description
// β PROBLEMATIC CODE
const res = await fetch(
https://api.github.com/users/${username}/events);const data = await res.json();
setEvents(data); // No validation - could be error response
Issue: No HTTP status validation. If the response is an error, data will contain an error object with message field, not an events array.
Impact: Runtime errors when trying to iterate over non-array data, application crashes.
Recommended Fix: Check res.ok before parsing JSON and validating response structure.
What browsers are you seeing the problem on?
No response
π Relevant Screenshots (Links)
No response