diff --git a/.changeset/hungry-dodos-fix.md b/.changeset/hungry-dodos-fix.md new file mode 100644 index 0000000000..0ee9714b45 --- /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/components/organisms/product-general-section/index.tsx b/packages/admin-ui/ui/src/components/organisms/product-general-section/index.tsx index 06675ab3f7..0bc8694631 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)} /> )} ) => { 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
  • } diff --git a/packages/admin-ui/webpack.config.dev.ts b/packages/admin-ui/webpack.config.dev.ts index 30e9622cc5..0c40e5f7e8 100644 --- a/packages/admin-ui/webpack.config.dev.ts +++ b/packages/admin-ui/webpack.config.dev.ts @@ -48,7 +48,7 @@ const getDevServerConfig = () => { onListening: function () { openBrowser(`http://localhost:7001`) }, - allowedHosts: 'auto', + allowedHosts: "auto", } as Configuration, }, }