fix(admin-ui): Add guard for null product_id (#3894)

* handle null variants differently

* add changeset
This commit is contained in:
Philip Korsholm authored and GitHub committed 2023-04-21 18:00:51 +02:00
1 parent 86613a5190
commit d302db2397
2 files changed
+7 -4

No files matched your search

@@ -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 = [
{