-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
'@shopify/shopify-app-remix': minor | ||
'@shopify/shopify-api': minor | ||
--- | ||
|
||
# Adds signal as request option | ||
|
||
This adds the `signal` option to the `request` method of the GraphQL client, for the shopify-api and shopify-app-remix packages to pass in an [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to abort requests, and set a timeout. | ||
|
||
If a request is aborted, an `HttpRequestError` will be thrown. | ||
|
||
This will allow you to set your own custom timeout, and abort requests. | ||
|
||
```ts | ||
// Abort the request after 3 seconds | ||
await admin.graphql('{ shop { name } }', { | ||
signal: AbortSignal.timeout(3000), | ||
}); | ||
``` | ||
|
||
```ts | ||
// Abort the request after 3 seconds, and retry the request up to 2 times | ||
await admin.graphql('{ shop { name } }', { | ||
signal: AbortSignal.timeout(3000), | ||
tries: 2, | ||
}); | ||
``` |