Skip to content

Commit

Permalink
Merge branch 'develop' into fix/price-list-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
riqwan authored Nov 24, 2023
2 parents fe06b7e + f4c489f commit 03d75c3
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/hungry-dodos-fix.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions .changeset/lemon-poems-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---

fix(medusa): update default admin query with product categories
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -294,7 +294,6 @@ const VariantValidity = ({
productDimensions,
}: Pick<Props, "source" | "productCustoms" | "productDimensions">) => {
const {
prices,
options,
dimensions,
customs,
Expand Down Expand Up @@ -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)
Expand All @@ -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"
Expand All @@ -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>}
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/webpack.config.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const getDevServerConfig = () => {
onListening: function () {
openBrowser(`http://localhost:7001`)
},
allowedHosts: 'auto',
allowedHosts: "auto",
} as Configuration,
},
}
Expand Down
13 changes: 12 additions & 1 deletion packages/medusa/src/api/routes/admin/products/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ export const defaultAdminProductRemoteQueryObject = {
fields: ["title", "handle", "id", "created_at", "updated_at", "deleted_at"],
},

categories: {
fields: [
"id",
"name",
"description",
"handle",
"is_active",
"is_internal",
"parent_category_id",
],
},

options: {
fields: [
"id",
Expand Down Expand Up @@ -503,4 +515,3 @@ export * from "./set-metadata"
export * from "./update-option"
export * from "./update-product"
export * from "./update-variant"

0 comments on commit 03d75c3

Please sign in to comment.