refactor: use flatMap
This commit is contained in:
1 parent
72718101c6
commit
cf15f5d498
1 file changed
+4
-4
@@ -928,8 +928,8 @@ export default class ProductModuleService<
|
|||||||
|
|
||||||
const collections: TProductCollection[] = []
|
const collections: TProductCollection[] = []
|
||||||
|
|
||||||
const updateSelectorAndData = updatedCollections
|
const updateSelectorAndData = updatedCollections.flatMap(
|
||||||
.map((collectionData) => {
|
(collectionData) => {
|
||||||
const input = normalizedInput.find((c) => c.id === collectionData.id)
|
const input = normalizedInput.find((c) => c.id === collectionData.id)
|
||||||
const productsToUpdate = (input as any)?.products
|
const productsToUpdate = (input as any)?.products
|
||||||
|
|
||||||
@@ -968,8 +968,8 @@ export default class ProductModuleService<
|
|||||||
})
|
})
|
||||||
|
|
||||||
return result
|
return result
|
||||||
})
|
}
|
||||||
.flat()
|
)
|
||||||
|
|
||||||
await this.productService_.update(updateSelectorAndData, sharedContext)
|
await this.productService_.update(updateSelectorAndData, sharedContext)
|
||||||
return collections
|
return collections
|
||||||
|
|||||||
Reference in new issue
Block a user