I have the following situation:
// page.tsx
export default async function CartDeliveryPage() {
const cart = await getCart()
return (
<>
{cart.items.map((item, index) => (
<ChooseDelivery item={item} />
)}
</>
)
}
// ChooseDelivery.tsx
export default async function ChooseDelivery({item}) {
await updateDeliveryMode({ shippingMethod: item.shippingMethod })
return (
...
)
}
Basically I fist get the cart, then for each item in my cart I update the delivery mode.
The problem is that after I update each delivery mode, I want to trigger a getCart() again to get the updated cart containing now the delivery modes.
What would be a clean way to handle this situation ?