From 5eaaea527f73851bf6c112e13bf44a29a68412c1 Mon Sep 17 00:00:00 2001 From: Linus Flood Date: Thu, 20 Nov 2025 13:24:34 +0000 Subject: [PATCH] Merged in feat/sw-3623-fetchretry (pull request #3180) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat(SW_3623): remove fetch-retry * feat(SW_3623): remove fetch-retry Approved-by: Joakim Jäderberg --- packages/trpc/lib/api/index.ts | 18 +++++------------- packages/trpc/lib/graphql/request.ts | 9 +-------- packages/trpc/package.json | 1 - yarn.lock | 8 -------- 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/packages/trpc/lib/api/index.ts b/packages/trpc/lib/api/index.ts index ee6e1b043..08df814f3 100644 --- a/packages/trpc/lib/api/index.ts +++ b/packages/trpc/lib/api/index.ts @@ -1,5 +1,4 @@ import merge from "deepmerge" -import fetchRetry from "fetch-retry" import { env } from "../../env/server" @@ -24,13 +23,6 @@ const defaultOptions: RequestInit = { mode: "cors", } -const wrappedFetch = fetchRetry(fetch, { - retries: 2, - retryDelay: function (attempt) { - return Math.pow(2, attempt) * 150 // 150, 300, 600 - }, -}) - export async function get( endpoint: Endpoint, options: RequestOptionsWithOutBody, @@ -40,7 +32,7 @@ export async function get( url.pathname = endpoint url.search = new URLSearchParams(params).toString() - return wrappedFetch(url, { + return fetch(url, { ...merge.all([defaultOptions, { method: "GET" }, options]), signal: AbortSignal.timeout(15_000), }) @@ -55,7 +47,7 @@ export async function patch( const url = new URL(env.API_BASEURL) url.pathname = endpoint url.search = new URLSearchParams(params).toString() - return wrappedFetch(url, { + return fetch(url, { ...merge.all([ defaultOptions, { body: JSON.stringify(body), method: "PATCH" }, @@ -74,7 +66,7 @@ export async function post( const url = new URL(env.API_BASEURL) url.pathname = endpoint url.search = new URLSearchParams(params).toString() - return wrappedFetch(url, { + return fetch(url, { ...merge.all([ defaultOptions, { body: JSON.stringify(body), method: "POST" }, @@ -93,7 +85,7 @@ export async function put( const url = new URL(env.API_BASEURL) url.pathname = endpoint url.search = new URLSearchParams(params).toString() - return wrappedFetch(url, { + return fetch(url, { ...merge.all([ defaultOptions, { body: JSON.stringify(body), method: "PUT" }, @@ -112,7 +104,7 @@ export async function remove( const url = new URL(env.API_BASEURL) url.pathname = endpoint url.search = new URLSearchParams(params).toString() - return wrappedFetch(url, { + return fetch(url, { ...merge.all([ defaultOptions, { body: JSON.stringify(body), method: "DELETE" }, diff --git a/packages/trpc/lib/graphql/request.ts b/packages/trpc/lib/graphql/request.ts index ced20e25f..060fb46e4 100644 --- a/packages/trpc/lib/graphql/request.ts +++ b/packages/trpc/lib/graphql/request.ts @@ -1,4 +1,3 @@ -import fetchRetry from "fetch-retry" import { type DocumentNode, print } from "graphql" import { GraphQLClient } from "graphql-request" import stringify from "json-stable-stringify-without-jsonify" @@ -77,13 +76,7 @@ function internalRequest( url: URL | RequestInfo, params?: RequestInit ) { - const wrappedFetch = fetchRetry(fetch, { - retries: 2, - retryDelay: function (attempt) { - return Math.pow(2, attempt) * 150 // 150, 300, 600 - }, - }) - return wrappedFetch(url, { + return fetch(url, { ...params, signal: AbortSignal.timeout(15_000), }) diff --git a/packages/trpc/package.json b/packages/trpc/package.json index be260ff03..6369d57c2 100644 --- a/packages/trpc/package.json +++ b/packages/trpc/package.json @@ -53,7 +53,6 @@ "@trpc/server": "^11.1.2", "dayjs": "^1.11.13", "deepmerge": "^4.3.1", - "fetch-retry": "^6.0.0", "fuse.js": "^7.1.0", "graphql": "^16.11.0", "graphql-request": "^7.1.2", diff --git a/yarn.lock b/yarn.lock index 0bd265e5f..788ab15ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5472,7 +5472,6 @@ __metadata: eslint: "npm:^9" eslint-plugin-import: "npm:^2.31.0" eslint-plugin-simple-import-sort: "npm:^12.1.1" - fetch-retry: "npm:^6.0.0" fuse.js: "npm:^7.1.0" graphql: "npm:^16.11.0" graphql-request: "npm:^7.1.2" @@ -9892,13 +9891,6 @@ __metadata: languageName: node linkType: hard -"fetch-retry@npm:^6.0.0": - version: 6.0.0 - resolution: "fetch-retry@npm:6.0.0" - checksum: 10c0/8e275b042ff98041236d30b71966f24c34ff19f957bb0f00e664754bd63d0dfb5122d091e7d5bca21f6370d88a1713d22421b33471305d7b86d6799427278802 - languageName: node - linkType: hard - "file-entry-cache@npm:^8.0.0": version: 8.0.0 resolution: "file-entry-cache@npm:8.0.0"