fix: handle abort error in useGithubStars hook

This commit is contained in:
CREDO23 2026-01-27 10:58:03 +02:00
parent 24472c0ea6
commit bd921a8ec8

View file

@ -25,6 +25,10 @@ export const useGithubStars = () => {
setStars(data?.stargazers_count);
} catch (err) {
// Ignore abort errors (expected on unmount)
if (err instanceof Error && err.name === "AbortError") {
return;
}
if (err instanceof Error) {
console.error("Error fetching stars:", err);
setError(err.message);
@ -37,7 +41,7 @@ export const useGithubStars = () => {
getStars();
return () => {
abortController.abort();
abortController.abort("Component unmounted");
};
}, []);