fix(admin-ui): Fix issue with null product categories (#5707)
* fix(admin-ui): If categories is null on a product the details page should not crash * cleanup variant warning to reflect pricing changes
This commit is contained in:
committed by
GitHub
parent
712c4496ce
commit
f4c489fb85
5
.changeset/hungry-dodos-fix.md
Normal file
5
.changeset/hungry-dodos-fix.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/admin-ui": patch
|
||||
---
|
||||
|
||||
fix(admin-ui): Fix an issue where if product.categories was null the details page would crash
|
||||
@@ -157,7 +157,7 @@ const ProductDetails = ({ product }: Props) => {
|
||||
{isFeatureEnabled(FeatureFlag.PRODUCT_CATEGORIES) && (
|
||||
<Detail
|
||||
title={t("product-general-section-category", "Category")}
|
||||
value={product.categories.map((c) => c.name)}
|
||||
value={product.categories?.map((c) => c.name)}
|
||||
/>
|
||||
)}
|
||||
<Detail
|
||||
|
||||
@@ -175,7 +175,7 @@ const NewVariant = ({
|
||||
ref={preview}
|
||||
data-handler-id={handlerId}
|
||||
className={clsx(
|
||||
"rounded-rounded py-xsmall pl-xsmall pr-base focus-within:bg-grey-5 hover:bg-grey-5 grid h-16 translate-y-0 translate-x-0 grid-cols-[32px_1fr_90px_100px_48px] transition-all",
|
||||
"rounded-rounded py-xsmall pl-xsmall pr-base focus-within:bg-grey-5 hover:bg-grey-5 grid h-16 translate-x-0 translate-y-0 grid-cols-[32px_1fr_90px_100px_48px] transition-all",
|
||||
{
|
||||
"opacity-50": isDragging,
|
||||
}
|
||||
@@ -294,7 +294,6 @@ const VariantValidity = ({
|
||||
productDimensions,
|
||||
}: Pick<Props, "source" | "productCustoms" | "productDimensions">) => {
|
||||
const {
|
||||
prices,
|
||||
options,
|
||||
dimensions,
|
||||
customs,
|
||||
@@ -335,8 +334,6 @@ const VariantValidity = ({
|
||||
)
|
||||
}
|
||||
|
||||
const validPrices = prices?.prices.some((p) => p.amount !== null)
|
||||
|
||||
const validDimensions =
|
||||
Object.values(productDimensions).every((value) => !!value) ||
|
||||
Object.values(dimensions).every((value) => !!value)
|
||||
@@ -346,13 +343,7 @@ const VariantValidity = ({
|
||||
|
||||
const barcodeValidity = !!barcode || !!upc || !!ean
|
||||
|
||||
if (
|
||||
!sku ||
|
||||
!validCustoms ||
|
||||
!validDimensions ||
|
||||
!barcodeValidity ||
|
||||
!validPrices
|
||||
) {
|
||||
if (!sku || !validCustoms || !validDimensions || !barcodeValidity) {
|
||||
return (
|
||||
<IconTooltip
|
||||
type="warning"
|
||||
@@ -364,7 +355,6 @@ const VariantValidity = ({
|
||||
fields:
|
||||
</p>
|
||||
<ul className="list-inside list-disc">
|
||||
{!validPrices && <li>Pricing</li>}
|
||||
{!validDimensions && <li>Dimensions</li>}
|
||||
{!validCustoms && <li>Customs</li>}
|
||||
{!inventory_quantity && <li>Inventory quantity</li>}
|
||||
|
||||
@@ -48,7 +48,7 @@ const getDevServerConfig = () => {
|
||||
onListening: function () {
|
||||
openBrowser(`http://localhost:7001`)
|
||||
},
|
||||
allowedHosts: 'auto',
|
||||
allowedHosts: "auto",
|
||||
} as Configuration,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user