diff --git a/src/store/index.js b/src/store/index.js index 02eca9806..6387e5e3f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2831,12 +2831,18 @@ function syncLineItemIds(lineItemsWithoutIds, lineItemsWithIds) { if (!lineItemsWithIds || !lineItemsWithoutIds) { return; } + var clonedLineItemsWithIds = deepClone(lineItemsWithIds); lineItemsWithoutIds.forEach((noId) => { - lineItemsWithIds.forEach((withId) => { + var matchedLineItemIndex = -1; + clonedLineItemsWithIds.forEach((withId, index) => { if (noId.partNumber === withId.partNumber && noId.partType === withId.partType) { + matchedLineItemIndex = index; noId.id = withId.id; } }); + if (matchedLineItemIndex > -1) { + clonedLineItemsWithIds.splice(matchedLineItemIndex, 1); + } }); }