fix(dashboard): create product selected inventory item display (#13111)

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Frane Polić
2025-08-18 19:30:56 +02:00
committed by GitHub
parent 20b8187e2a
commit c6b836bb03
2 changed files with 11 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---
fix(dashboard): create product selected inventory item display

View File

@@ -31,10 +31,15 @@ function InventoryItemRow({
}: InventoryItemRowProps) {
const { t } = useTranslation()
const selectedInventoryItemId = useWatch({
control: form.control,
name: `variants.${variantIndex}.inventory.${inventoryIndex}.inventory_item_id`,
})
const items = useComboboxData({
queryKey: ["inventory_items"],
defaultValueKey: "id",
defaultValue: inventoryItem.inventory_item_id, // prefetch existing inventory items
selectedValue: selectedInventoryItemId,
queryFn: (params) => sdk.admin.inventoryItem.list(params),
getOptions: (data) =>
data.inventory_items.map((item) => ({