fix(medusa): fix rank order changing on category update (#3486)

what:

- fixes issue where ranking changes when only properties other than rank are updated on categories

FIXES CORE-1253
This commit is contained in:
Riqwan Thamir
2023-03-16 08:53:49 +00:00
committed by GitHub
parent 13f40d7217
commit 061a600f80
3 changed files with 53 additions and 1 deletions
@@ -310,7 +310,9 @@ class ProductCategoryService extends TransactionBaseService {
const targetRank = input.rank
const shouldChangeParent =
targetParentId !== undefined && targetParentId !== originalParentId
const shouldChangeRank = shouldChangeParent || originalRank !== targetRank
const shouldChangeRank =
shouldChangeParent ||
(isDefined(targetRank) && originalRank !== targetRank)
return {
targetCategoryId: productCategory.id,