From 1341261405eceea5c64f1d7d4f501696ae9a55f7 Mon Sep 17 00:00:00 2001 From: Victor Almeida Date: Mon, 12 Dec 2022 09:30:02 -0300 Subject: [PATCH] Change add to cart process to synchronous to avoid loss of data --- CHANGELOG.md | 4 ++++ react/UploadBlock.tsx | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eded3df3..4b74ff52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- Change add to cart process to synchronous to avoid loss of data in some cases + ## [3.12.3] - 2022-11-23 ### Added diff --git a/react/UploadBlock.tsx b/react/UploadBlock.tsx index 5d5843a4..c56360dd 100644 --- a/react/UploadBlock.tsx +++ b/react/UploadBlock.tsx @@ -235,7 +235,8 @@ const UploadBlock: FunctionComponent< if (chunk.length) { const currentItemsInCart = orderForm.orderForm.items - const mutationChunk = addToCart({ + // eslint-disable-next-line no-await-in-loop + const mutationChunk = await addToCart({ variables: { items: chunk.map((item: ItemType) => { const [existsInCurrentOrder] = currentItemsInCart.filter(