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:
Frane Polić authored and GitHub committed 2024-10-09 17:54:35 +00:00
1 parent 7f1f075222
commit 1b9379be62
6 files changed
+44 -17

No files matched your search

@@ -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,