From cf15f5d49810ba6b1c83d650e6c283d271d06e9a Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Fri, 17 May 2024 15:31:50 +0530 Subject: [PATCH] refactor: use flatMap --- .../product/src/services/product-module-service.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/modules/product/src/services/product-module-service.ts b/packages/modules/product/src/services/product-module-service.ts index 1f5f1e3ca3..2747597f91 100644 --- a/packages/modules/product/src/services/product-module-service.ts +++ b/packages/modules/product/src/services/product-module-service.ts @@ -928,8 +928,8 @@ export default class ProductModuleService< const collections: TProductCollection[] = [] - const updateSelectorAndData = updatedCollections - .map((collectionData) => { + const updateSelectorAndData = updatedCollections.flatMap( + (collectionData) => { const input = normalizedInput.find((c) => c.id === collectionData.id) const productsToUpdate = (input as any)?.products @@ -968,8 +968,8 @@ export default class ProductModuleService< }) return result - }) - .flat() + } + ) await this.productService_.update(updateSelectorAndData, sharedContext) return collections