diff --git a/.changeset/smooth-hounds-sip.md b/.changeset/smooth-hounds-sip.md new file mode 100644 index 0000000000..1aa4e65348 --- /dev/null +++ b/.changeset/smooth-hounds-sip.md @@ -0,0 +1,5 @@ +--- +"@medusajs/dashboard": patch +--- + +fix(dashboard): create product selected inventory item display diff --git a/packages/admin/dashboard/src/routes/products/product-create/components/product-create-inventory-kit-form/components/product-create-inventory-kit-section/product-create-inventory-kit-section.tsx b/packages/admin/dashboard/src/routes/products/product-create/components/product-create-inventory-kit-form/components/product-create-inventory-kit-section/product-create-inventory-kit-section.tsx index 5b7206c958..5d12d31998 100644 --- a/packages/admin/dashboard/src/routes/products/product-create/components/product-create-inventory-kit-form/components/product-create-inventory-kit-section/product-create-inventory-kit-section.tsx +++ b/packages/admin/dashboard/src/routes/products/product-create/components/product-create-inventory-kit-form/components/product-create-inventory-kit-section/product-create-inventory-kit-section.tsx @@ -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) => ({