fix(product): returned updates order in upsertWithReplace (#12486)

* add failing test for upsertWithReplace order

* reproduce prices update shuffling issue

* fix: fix order of returned updates in updateMany

* fix: fix order of returned updates in ProductService

* fix: reset test count to 1

* Create tame-insects-marry.md

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Pedro Guzman
2025-05-15 09:22:24 +02:00
committed by GitHub
co-authored by Oli Juhl
parent c661e06488
commit 142a1f0a5b
5 changed files with 182 additions and 16 deletions
@@ -72,7 +72,12 @@ export class ProductRepository extends DALUtils.mikroOrmBaseRepositoryFactory(
wrap(product!).assign(update)
}
return products
// Doing this to ensure updates are returned in the same order they were provided,
// since some core flows rely on this.
// This is a high level of coupling though.
return updates
.map((update) => productsMap.get(update.id))
.filter((product) => product !== undefined)
}
/**