From 6ee90c7c266343b1c17ab2f8fd22754864503c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Sun, 15 Feb 2026 03:06:56 +0100 Subject: [PATCH] pl-api: enable perf rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- packages/pl-api/.oxlintrc.json | 3 ++- packages/pl-api/lib/client.ts | 27 ++++++++++++++++++-------- packages/pl-api/lib/params/settings.ts | 2 +- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/packages/pl-api/.oxlintrc.json b/packages/pl-api/.oxlintrc.json index ad54a5067..98a967302 100644 --- a/packages/pl-api/.oxlintrc.json +++ b/packages/pl-api/.oxlintrc.json @@ -4,7 +4,8 @@ "categories": { "correctness": "error", "suspicious": "error", - "pedantic": "warn" + "pedantic": "warn", + "perf": "warn", }, "rules": { "max-dependencies": "off", diff --git a/packages/pl-api/lib/client.ts b/packages/pl-api/lib/client.ts index b2276cdce..2e252ea4b 100644 --- a/packages/pl-api/lib/client.ts +++ b/packages/pl-api/lib/client.ts @@ -948,14 +948,25 @@ class PlApiClient { let response: any; if (this.features.version.software === PIXELFED) { - response = []; - for (const accountId of accountIds) { - const accounts = (await this.request(`/api/v1.1/accounts/mutuals/${accountId}`)).json; - response.push({ - id: accountId, - accounts, - }); - } + const settledResponse = await Promise.allSettled( + accountIds.map(async (accountId) => { + const accounts = (await this.request(`/api/v1.1/accounts/mutuals/${accountId}`)).json; + + return { + id: accountId, + accounts, + }; + }), + ); + + response = settledResponse.map((result, index) => + result.status === 'fulfilled' + ? result.value + : { + id: accountIds[index], + accounts: [], + }, + ); } else { response = ( await this.request('/api/v1/accounts/familiar_followers', { params: { id: accountIds } }) diff --git a/packages/pl-api/lib/params/settings.ts b/packages/pl-api/lib/params/settings.ts index a748fbdf1..94d1633d0 100644 --- a/packages/pl-api/lib/params/settings.ts +++ b/packages/pl-api/lib/params/settings.ts @@ -45,7 +45,7 @@ type CreateAccountParams = { /** EIP-4361 signature (required if message is present) */ signature: string; } - | Record + | {} ); /**