mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
fix: handle abort error in useGithubStars hook
This commit is contained in:
parent
24472c0ea6
commit
bd921a8ec8
1 changed files with 5 additions and 1 deletions
|
|
@ -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");
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue