From 36f30b4833c4b8c4e9b882d40ecee0ce0799e782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frane=20Poli=C4=87?= <16856471+fPolic@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:21:04 +0200 Subject: [PATCH] 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) --- packages/admin/dashboard/src/hooks/api/fulfillment.tsx | 6 +++--- packages/admin/dashboard/src/hooks/api/orders.tsx | 10 +++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/admin/dashboard/src/hooks/api/fulfillment.tsx b/packages/admin/dashboard/src/hooks/api/fulfillment.tsx index 0ec6c8f480..e255351cbc 100644 --- a/packages/admin/dashboard/src/hooks/api/fulfillment.tsx +++ b/packages/admin/dashboard/src/hooks/api/fulfillment.tsx @@ -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) }, diff --git a/packages/admin/dashboard/src/hooks/api/orders.tsx b/packages/admin/dashboard/src/hooks/api/orders.tsx index 45d4b565cd..0d1c2b6563 100644 --- a/packages/admin/dashboard/src/hooks/api/orders.tsx +++ b/packages/admin/dashboard/src/hooks/api/orders.tsx @@ -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({