Closed gomorizsolt closed 4 years ago
As-is: the component occupies the space and the star icon appears even if there's an error while fetching from the GitHub API:
It's because if the fetch fails, the response is still valid to be parsed to json:
{message: "Not Found", documentation_url: "https://developer.github.com/v3/repos/#get"}
Expectation: log an error to the console (optionally display an error message in place of the component).
Proposal: utilize the well-tested safeParseJson() function (this way the outcome of the fetch depends on its ok property).
safeParseJson()
ok
Resolved by #132.
As-is: the component occupies the space and the star icon appears even if there's an error while fetching from the GitHub API:
It's because if the fetch fails, the response is still valid to be parsed to json:
Expectation: log an error to the console (optionally display an error message in place of the component).
Proposal: utilize the well-tested
safeParseJson()
function (this way the outcome of the fetch depends on itsok
property).