Skip to content

Commit c1f492c

Browse files
committed
don't fire oncancel if the request has finished
1 parent 17ca3a9 commit c1f492c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/core/src/request.ts

+5
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ export class Request {
8585
}
8686

8787
public cancel({ cancelled = false, interrupted = false }: { cancelled?: boolean; interrupted?: boolean }): void {
88+
if (this.requestHasFinished) {
89+
// If the request has already finished, there's no need to cancel it
90+
return
91+
}
92+
8893
this.cancelToken.abort()
8994

9095
this.requestParams.markAsCancelled({ cancelled, interrupted })

0 commit comments

Comments
 (0)