From 6b3e414cd0349c93409b5e28ac27f2967ffba54c Mon Sep 17 00:00:00 2001 From: Kasper Date: Fri, 24 Nov 2023 11:57:33 +0000 Subject: [PATCH 1/2] fix(admin-ui): If categories is null on a product the details page should not crash --- .../src/components/organisms/product-general-section/index.tsx | 2 +- packages/admin-ui/webpack.config.dev.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/admin-ui/ui/src/components/organisms/product-general-section/index.tsx b/packages/admin-ui/ui/src/components/organisms/product-general-section/index.tsx index 06675ab3f79fc..0bc8694631ba6 100644 --- a/packages/admin-ui/ui/src/components/organisms/product-general-section/index.tsx +++ b/packages/admin-ui/ui/src/components/organisms/product-general-section/index.tsx @@ -157,7 +157,7 @@ const ProductDetails = ({ product }: Props) => { {isFeatureEnabled(FeatureFlag.PRODUCT_CATEGORIES) && ( c.name)} + value={product.categories?.map((c) => c.name)} /> )} { onListening: function () { openBrowser(`http://localhost:7001`) }, - allowedHosts: 'auto', + allowedHosts: "auto", } as Configuration, }, } From da7758c3634e6e7c793629e61be9290113c33afd Mon Sep 17 00:00:00 2001 From: Kasper Date: Fri, 24 Nov 2023 12:03:13 +0000 Subject: [PATCH 2/2] cleanup variant warning to reflect pricing changes --- .changeset/hungry-dodos-fix.md | 5 +++++ .../new/add-variants/new-variant/index.tsx | 14 ++------------ 2 files changed, 7 insertions(+), 12 deletions(-) create mode 100644 .changeset/hungry-dodos-fix.md diff --git a/.changeset/hungry-dodos-fix.md b/.changeset/hungry-dodos-fix.md new file mode 100644 index 0000000000000..0ee9714b45012 --- /dev/null +++ b/.changeset/hungry-dodos-fix.md @@ -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 diff --git a/packages/admin-ui/ui/src/domain/products/new/add-variants/new-variant/index.tsx b/packages/admin-ui/ui/src/domain/products/new/add-variants/new-variant/index.tsx index c2a9120d91069..6c90f4a2599eb 100644 --- a/packages/admin-ui/ui/src/domain/products/new/add-variants/new-variant/index.tsx +++ b/packages/admin-ui/ui/src/domain/products/new/add-variants/new-variant/index.tsx @@ -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) => { 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 (
    - {!validPrices &&
  • Pricing
  • } {!validDimensions &&
  • Dimensions
  • } {!validCustoms &&
  • Customs
  • } {!inventory_quantity &&
  • Inventory quantity
  • }