fix(core-flows): Remove concurrent steps that rely on the same data update (#9438)

**What**
The `updateTaxLinesWorkflow` rely on the cart shipping method meaning that concurrent refresh of shipping method can impact tax lines therefore leading to wrong tax lines
This commit is contained in:
Adrien de Peretti authored and GitHub committed 2024-10-03 09:00:32 +00:00
1 parent c536f7caf5
commit 193f93464f
1 file changed
+10 -11
@@ -3,11 +3,11 @@ import {
CreateLineItemForCartDTO, CreateLineItemForCartDTO,
} from "@medusajs/framework/types" } from "@medusajs/framework/types"
import { import {
WorkflowData,
WorkflowResponse,
createWorkflow, createWorkflow,
parallelize, parallelize,
transform, transform,
WorkflowData,
WorkflowResponse,
} from "@medusajs/framework/workflows-sdk" } from "@medusajs/framework/workflows-sdk"
import { useRemoteQueryStep } from "../../common/steps/use-remote-query" import { useRemoteQueryStep } from "../../common/steps/use-remote-query"
import { import {
@@ -120,15 +120,14 @@ export const addToCartWorkflow = createWorkflow(
list: false, list: false,
}).config({ name: "refetch–cart" }) }).config({ name: "refetch–cart" })
parallelize( refreshCartShippingMethodsStep({ cart })
refreshCartShippingMethodsStep({ cart }),
updateTaxLinesWorkflow.runAsStep({ updateTaxLinesWorkflow.runAsStep({
input: { input: {
cart_id: input.cart.id, cart_id: input.cart.id,
items, items,
}, },
}) })
)
updateCartPromotionsWorkflow.runAsStep({ updateCartPromotionsWorkflow.runAsStep({
input: { input: {