feat(core-flows,types,utils,medusa): Update existing line items when adding the same variant to cart (#7470)

* feat(core-flows,types,utils,medusa): Update existing line items when adding the same variant to cart

* chore: split steps into 2 for add-to-cart

* chore: split steps into 2 for add-to-cart

* chore: iterate safely

* chore: parallelize upsert
This commit is contained in:
Riqwan Thamir
2024-05-27 17:54:11 +02:00
committed by GitHub
parent 81c27e3524
commit 7baedf73d5
16 changed files with 339 additions and 49 deletions

View File

@@ -1,4 +1,4 @@
export function deepEqualObj(obj1: object, obj2: object): boolean {
export function deepEqualObj(obj1: unknown, obj2: unknown): boolean {
if (typeof obj1 !== typeof obj2) {
return false
}
@@ -7,6 +7,10 @@ export function deepEqualObj(obj1: object, obj2: object): boolean {
return obj1 === obj2
}
if (typeof obj2 !== "object" || obj2 === null) {
return obj2 === obj1
}
const obj1Keys = Object.keys(obj1)
const obj2Keys = Object.keys(obj2)