diff --git a/.changeset/rare-monkeys-press.md b/.changeset/rare-monkeys-press.md new file mode 100644 index 0000000000..24736b63b9 --- /dev/null +++ b/.changeset/rare-monkeys-press.md @@ -0,0 +1,5 @@ +--- +"@medusajs/admin-ui": patch +--- + +fix(admin): add guard for null variant in inventory overview diff --git a/packages/admin-ui/ui/src/components/templates/inventory-table/index.tsx b/packages/admin-ui/ui/src/components/templates/inventory-table/index.tsx index 40b5bf2174..409b248ffe 100644 --- a/packages/admin-ui/ui/src/components/templates/inventory-table/index.tsx +++ b/packages/admin-ui/ui/src/components/templates/inventory-table/index.tsx @@ -12,6 +12,7 @@ import { useAdminUpdateLocationLevel, useAdminVariant, } from "medusa-react" +import { useLocation, useNavigate } from "react-router-dom" import Button from "../../fundamentals/button" import ImagePlaceholder from "../../fundamentals/image-placeholder" @@ -27,7 +28,6 @@ import { isEmpty } from "lodash" import qs from "qs" import { useInventoryFilters } from "./use-inventory-filters" import useInventoryTableColumn from "./use-inventory-column" -import { useLocation, useNavigate } from "react-router-dom" import useNotification from "../../../hooks/use-notification" import useToggleState from "../../../hooks/use-toggle-state" @@ -306,9 +306,7 @@ const InventoryRow = ({ } = useToggleState() const getRowActionables = () => { - const productId = inventory.variants?.length - ? inventory.variants[0].product_id - : null + const productId = inventory.variants?.[0]?.product_id const actions = [ {