fix(order): Prevent fetching all db adjustments when no items are pre… (#14351)
* fix(order): Prevent fetching all db adjustments when no items are present * Create funny-suns-think.md
This commit is contained in:
committed by
GitHub
parent
7172995bde
commit
fb6a6b52fa
5
.changeset/funny-suns-think.md
Normal file
5
.changeset/funny-suns-think.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/order": patch
|
||||
---
|
||||
|
||||
fix(order): Prevent fetching all db adjustments when no items are pre…
|
||||
@@ -225,6 +225,10 @@ async function loadItemAdjustments(manager, orders) {
|
||||
const items = orders.flatMap((r) => [...(r.items ?? [])])
|
||||
const itemsIdMap = new Map<string, any>(items.map((i) => [i.item.id, i.item]))
|
||||
|
||||
if (!items.length) {
|
||||
return
|
||||
}
|
||||
|
||||
const params = items.map((i) => {
|
||||
// preinitialise all items so an empty array is returned for ones without adjustments
|
||||
if (!i.item.adjustments.isInitialized()) {
|
||||
|
||||
Reference in New Issue
Block a user