Skip to content

Commit

Permalink
fix(callapi,callapi-legacy): update version and improve request cance…
Browse files Browse the repository at this point in the history
…llation messaging
  • Loading branch information
Ryan-Zayne committed Nov 15, 2024
1 parent 4caa717 commit 5fb5d44
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/callapi-legacy/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zayne-labs/callapi-legacy",
"type": "module",
"version": "1.0.0-rc.11",
"version": "1.0.0-rc.12",
"description": "A lightweight wrapper over fetch with quality of life improvements like built-in request cancellation, retries, interceptors and more",
"author": "Ryan Zayne",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions packages/callapi-legacy/src/createFetchClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ export const createFetchClient = <
const prevRequestInfo = requestInfoCacheOrNull?.get(requestKey);

if (prevRequestInfo && options.dedupeStrategy === "cancel") {
const message = requestKey
const message = options.requestKey
? `Request aborted as another request with the same request key: '${requestKey}' was initiated while the current request was in progress.`
: `Request aborted as another request to the endpoint: '${url}', with the same request options was initiated while the current request was in progress.`;
: `Request aborted as another request to the endpoint: '${fullUrl}', with the same request options was initiated while the current request was in progress.`;

const reason = new DOMException(message, "AbortError");

Expand Down
2 changes: 1 addition & 1 deletion packages/callapi/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zayne-labs/callapi",
"type": "module",
"version": "1.0.0-rc.27",
"version": "1.0.0-rc.28",
"description": "A lightweight wrapper over fetch with quality of life improvements like built-in request cancellation, retries, interceptors and more",
"author": "Ryan Zayne",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions packages/callapi/src/createFetchClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ export const createFetchClient = <
const prevRequestInfo = requestInfoCacheOrNull?.get(requestKey);

if (prevRequestInfo && options.dedupeStrategy === "cancel") {
const message = requestKey
const message = options.requestKey
? `Request aborted as another request with the same request key: '${requestKey}' was initiated while the current request was in progress.`
: `Request aborted as another request to the endpoint: '${url}', with the same request options was initiated while the current request was in progress.`;
: `Request aborted as another request to the endpoint: '${fullUrl}', with the same request options was initiated while the current request was in progress.`;

const reason = new DOMException(message, "AbortError");

Expand Down

0 comments on commit 5fb5d44

Please sign in to comment.