Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: add abort request example (#3413)

Bobbie Soedirgoe7d156df8508
diff --git a/web/spec/supabase.yml b/web/spec/supabase.yml
index a3ef1d31b3f..4eb74f1703c 100644
--- a/web/spec/supabase.yml
+++ b/web/spec/supabase.yml
@@ -591,6 +591,32 @@ pages:
.select()
.csv()
```
+ - name: Aborting requests in-flight
+ description: |
+ You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests. Note that `status` and `statusText` doesn't mean anything for aborted requests, since the request wasn't actually fulfilled.
+ js: |
+ ```js
+ const ac = new AbortController()
+ supabase
+ .from('very_big_table')
+ .select()
+ .abortSignal(ac.signal)
+ .then(console.log)
+ ac.abort()
+ // {
+ // error: {
+ // message: 'FetchError: The user aborted a request.',
+ // details: '',
+ // hint: '',
+ // code: ''
+ // },
+ // data: null,
+ // body: null,
+ // count: null,
+ // status: 400,
+ // statusText: 'Bad Request'
+ // }
+ ```
insert():
title: 'Create data: insert()'