From 2c2cd1a3a3617084328f770167b423f0270fc10a Mon Sep 17 00:00:00 2001 From: Leo Singer Date: Thu, 29 Feb 2024 17:17:53 -0500 Subject: [PATCH] Remove duplicate validation in putSynonyms Also, perform the validation earlier to prevent unnecessary work. --- app/routes/_gcn.synonyms/synonyms.server.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/routes/_gcn.synonyms/synonyms.server.ts b/app/routes/_gcn.synonyms/synonyms.server.ts index f650646ac..f18ffdbec 100644 --- a/app/routes/_gcn.synonyms/synonyms.server.ts +++ b/app/routes/_gcn.synonyms/synonyms.server.ts @@ -56,12 +56,11 @@ export async function putSynonyms({ additions?: string[] subtractions?: string[] }) { + if (!subtractions?.length && !additions?.length) return const db = await tables() const client = db._doc as unknown as DynamoDBDocument const TableName = db.name('synonyms') const writes = [] - if (!subtractions && !additions) return - if (subtractions?.length === 0 && additions?.length === 0) return if (subtractions) { const subtraction_writes = subtractions.map((eventId) => ({ DeleteRequest: {