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:
@@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user