From 6f70548bb5a305a059a726c2fc40329595b610ae Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Mon, 13 Oct 2025 13:03:05 +1100 Subject: [PATCH] fix: multi email bug --- packages/ui/primitives/document-flow/add-signers.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui/primitives/document-flow/add-signers.tsx b/packages/ui/primitives/document-flow/add-signers.tsx index 2010775c4..94c7690b0 100644 --- a/packages/ui/primitives/document-flow/add-signers.tsx +++ b/packages/ui/primitives/document-flow/add-signers.tsx @@ -216,6 +216,7 @@ export const AddSignersFormPartial = ({ // Sync the response recipients back to form state to prevent duplicates if (response?.recipients) { const currentSigners = form.getValues('signers'); + const updatedSigners = currentSigners.map((signer) => { // Find the matching recipient from the response using nativeId const matchingRecipient = response.recipients.find( @@ -228,10 +229,9 @@ export const AddSignersFormPartial = ({ ...signer, nativeId: matchingRecipient.id, }; - } - - // For new signers without nativeId, match by email and update with server ID - if (!signer.nativeId) { + } else if (!signer.nativeId) { + // For new signers without nativeId, match by email and update with server ID + // Bug: Multiple recipients with the same email will be matched incorrectly here. const newRecipient = response.recipients.find( (recipient) => recipient.email === signer.email, );