fix: abort ongoing requests when changing pages (#3927)

This commit is contained in:
manx98 authored and GitHub committed 2025-06-29 09:38:03 +02:00
1 parent 2d1a82b73f
commit 93c4b2e03c
6 files changed
+75 -24

No files matched your search

+7 -2
View File
@@ -6,7 +6,8 @@ import { encodePath } from "@/utils/url";
export class StatusError extends Error {
constructor(
message: any,
public status?: number
public status?: number,
public is_canceled?: boolean
) {
super(message);
this.name = "StatusError";
@@ -33,7 +34,11 @@ export async function fetchURL(
},
...rest,
});
} catch {
} catch (e) {
// Check if the error is an intentional cancellation
if (e instanceof Error && e.name === "AbortError") {
throw new StatusError("000 No connection", 0, true);
}
throw new StatusError("000 No connection", 0);
}