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:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/dashboard": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(dashboard): create product selected inventory item display
|
||||||
+6
-1
@@ -31,10 +31,15 @@ function InventoryItemRow({
|
|||||||
}: InventoryItemRowProps) {
|
}: InventoryItemRowProps) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
|
const selectedInventoryItemId = useWatch({
|
||||||
|
control: form.control,
|
||||||
|
name: `variants.${variantIndex}.inventory.${inventoryIndex}.inventory_item_id`,
|
||||||
|
})
|
||||||
|
|
||||||
const items = useComboboxData({
|
const items = useComboboxData({
|
||||||
queryKey: ["inventory_items"],
|
queryKey: ["inventory_items"],
|
||||||
defaultValueKey: "id",
|
defaultValueKey: "id",
|
||||||
defaultValue: inventoryItem.inventory_item_id, // prefetch existing inventory items
|
selectedValue: selectedInventoryItemId,
|
||||||
queryFn: (params) => sdk.admin.inventoryItem.list(params),
|
queryFn: (params) => sdk.admin.inventoryItem.list(params),
|
||||||
getOptions: (data) =>
|
getOptions: (data) =>
|
||||||
data.inventory_items.map((item) => ({
|
data.inventory_items.map((item) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user