fix(dashboard): refresh order list when fulfilment status changes (#9076)

**What**
- update order list when fulfillment/shipment status changes

---

RESOLVES TRI-224
CLOSES [9052](https://github.com/medusajs/medusa/issues/9052)
This commit is contained in:
Frane Polić
2024-09-10 14:21:04 +02:00
committed by GitHub
parent 4b663a4559
commit 36f30b4833
2 changed files with 6 additions and 10 deletions

View File

@@ -19,7 +19,7 @@ export const useCreateFulfillment = (
onSuccess: (data: any, variables: any, context: any) => {
queryClient.invalidateQueries({ queryKey: fulfillmentsQueryKeys.lists() })
queryClient.invalidateQueries({
queryKey: ordersQueryKeys.details(),
queryKey: ordersQueryKeys.all,
})
options?.onSuccess?.(data, variables, context)
},
@@ -36,7 +36,7 @@ export const useCancelFulfillment = (
onSuccess: (data: any, variables: any, context: any) => {
queryClient.invalidateQueries({ queryKey: fulfillmentsQueryKeys.lists() })
queryClient.invalidateQueries({
queryKey: ordersQueryKeys.details(),
queryKey: ordersQueryKeys.all,
})
options?.onSuccess?.(data, variables, context)
},
@@ -57,7 +57,7 @@ export const useCreateFulfillmentShipment = (
sdk.admin.fulfillment.createShipment(fulfillmentId, payload),
onSuccess: (data: any, variables: any, context: any) => {
queryClient.invalidateQueries({
queryKey: ordersQueryKeys.details(),
queryKey: ordersQueryKeys.all,
})
options?.onSuccess?.(data, variables, context)
},

View File

@@ -121,11 +121,7 @@ export const useCreateOrderFulfillment = (
sdk.admin.order.createFulfillment(orderId, payload),
onSuccess: (data: any, variables: any, context: any) => {
queryClient.invalidateQueries({
queryKey: ordersQueryKeys.details(),
})
queryClient.invalidateQueries({
queryKey: ordersQueryKeys.preview(orderId),
queryKey: ordersQueryKeys.all,
})
queryClient.invalidateQueries({
@@ -148,7 +144,7 @@ export const useCancelOrderFulfillment = (
sdk.admin.order.cancelFulfillment(orderId, fulfillmentId, payload),
onSuccess: (data: any, variables: any, context: any) => {
queryClient.invalidateQueries({
queryKey: ordersQueryKeys.details(),
queryKey: ordersQueryKeys.all,
})
queryClient.invalidateQueries({
@@ -175,7 +171,7 @@ export const useCreateOrderShipment = (
sdk.admin.order.createShipment(orderId, fulfillmentId, payload),
onSuccess: (data: any, variables: any, context: any) => {
queryClient.invalidateQueries({
queryKey: ordersQueryKeys.details(),
queryKey: ordersQueryKeys.all,
})
queryClient.invalidateQueries({