fix(admin-ui): Allow backorder update on variants (#4051)

This commit is contained in:
Philip Korsholm
2023-05-16 17:28:45 +02:00
committed by GitHub
parent 4fb443c0ea
commit 2945769497
7 changed files with 40 additions and 23 deletions
@@ -7,7 +7,7 @@ import TrashIcon from "../../../../components/fundamentals/icons/trash-icon"
import { getErrorMessage } from "../../../../utils/error-messages"
import moment from "moment"
import { parse } from "iso8601-duration"
import { removeNullish } from "../../../../utils/remove-nullish"
import { removeFalsy } from "../../../../utils/remove-nullish"
import { useAdminUpdateDiscount } from "medusa-react"
import useNotification from "../../../../hooks/use-notification"
@@ -103,7 +103,7 @@ const useDiscountConfigurations = (discount: Discount) => {
title: "Duration",
description: (
<CommonDescription
text={Object.entries(removeNullish(parse(discount.valid_duration)))
text={Object.entries(removeFalsy(parse(discount.valid_duration)))
.map(([key, value]) => `${value} ${key}`)
.join(", ")}
/>
@@ -32,7 +32,7 @@ import WarningCircleIcon from "../../../../components/fundamentals/icons/warning
import { displayAmount } from "../../../../utils/prices"
import { getAllReturnableItems } from "../utils/create-filtering"
import { getErrorMessage } from "../../../../utils/error-messages"
import { removeNullish } from "../../../../utils/remove-nullish"
import { removeFalsy } from "../../../../utils/remove-nullish"
import { useFeatureFlag } from "../../../../providers/feature-flag-provider"
import useNotification from "../../../../hooks/use-notification"
@@ -181,7 +181,7 @@ const ReturnMenu: React.FC<ReturnMenuProps> = ({ order, onDismiss }) => {
...value,
}
delete toSet.reason
const clean = removeNullish(toSet)
const clean = removeFalsy(toSet)
return {
item_id: key,
...(clean as { quantity: number }),