diff --git a/packages/admin/dashboard/src/hooks/api/categories.tsx b/packages/admin/dashboard/src/hooks/api/categories.tsx index 9c0991aaa4..1d34c47903 100644 --- a/packages/admin/dashboard/src/hooks/api/categories.tsx +++ b/packages/admin/dashboard/src/hooks/api/categories.tsx @@ -143,6 +143,10 @@ export const useUpdateProductCategoryProducts = ( queryKey: productsQueryKeys.lists(), }) + queryClient.invalidateQueries({ + queryKey: productsQueryKeys.details(), + }) + options?.onSuccess?.(data, variables, context) }, ...options, diff --git a/packages/core/core-flows/src/product/steps/batch-link-products-in-category.ts b/packages/core/core-flows/src/product/steps/batch-link-products-in-category.ts index 6918580c23..1c8e705798 100644 --- a/packages/core/core-flows/src/product/steps/batch-link-products-in-category.ts +++ b/packages/core/core-flows/src/product/steps/batch-link-products-in-category.ts @@ -26,7 +26,8 @@ export const batchLinkProductsToCategoryStep = createStep( const dbProducts = await service.listProducts( { id: [...(data.add ?? []), ...(data.remove ?? [])] }, { - select: ["id", "categories"], + select: ["id"], + relations: ["categories"], } ) @@ -65,7 +66,8 @@ export const batchLinkProductsToCategoryStep = createStep( const dbProducts = await service.listProducts( { id: prevData.productIds }, { - select: ["id", "categories"], + select: ["id"], + relations: ["categories"], } )