fix(core-flows, dashboard): inventory kit reservations (#9502)
**What** - fix `prepareConfirmInventory` to account for inventory kit items - _note: this step is reused in the complete cart and all RMA flows_ - properly remove reservations for items that are removed from the order edit - invalidate inventory/reservations cache when order edit is confirmed --- https://github.com/user-attachments/assets/f12e9198-0718-4c08-bd81-efc536eca146 --- FIXES CC-565
This commit is contained in:
@@ -6,6 +6,8 @@ import { sdk } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { ordersQueryKeys } from "./orders"
|
||||
import { FetchError } from "@medusajs/js-sdk"
|
||||
import { reservationItemsQueryKeys } from "./reservations"
|
||||
import { inventoryItemsQueryKeys } from "./inventory.tsx"
|
||||
|
||||
export const useCreateOrderEdit = (
|
||||
orderId: string,
|
||||
@@ -82,6 +84,19 @@ export const useConfirmOrderEdit = (
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ordersQueryKeys.changes(id),
|
||||
})
|
||||
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: reservationItemsQueryKeys.lists(),
|
||||
})
|
||||
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: inventoryItemsQueryKeys.lists(),
|
||||
})
|
||||
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: inventoryItemsQueryKeys.details(),
|
||||
})
|
||||
|
||||
options?.onSuccess?.(data, variables, context)
|
||||
},
|
||||
...options,
|
||||
|
||||
Reference in New Issue
Block a user