From ca6efd8852228da83dcbc1998a736d1f93837162 Mon Sep 17 00:00:00 2001 From: Thalyta Fabrine Date: Tue, 19 Mar 2024 11:49:07 +0100 Subject: [PATCH] Remove sku specs with no values --- CHANGELOG.md | 3 +++ src/convertSearchDocument.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d0993b..80bda44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Fixed +- Remove specifications with no values from `skuSpecifications`. + ## [1.6.1] - 2024-03-18 ### Fixed diff --git a/src/convertSearchDocument.ts b/src/convertSearchDocument.ts index 7d2266f..b121067 100644 --- a/src/convertSearchDocument.ts +++ b/src/convertSearchDocument.ts @@ -153,6 +153,10 @@ const skuSpecificationsFromDocuments = ( }) skuSpecs.forEach((specification) => { + if (!specification.SpecificationValues.length) { + return + } + groupedSpecs[specification.FieldId] = { Name: specification.Name, SpecificationValues: (groupedSpecs[specification.FieldId]?.SpecificationValues ?? []).concat(