From fec078081b765e0ebba35d656de89c5de312a071 Mon Sep 17 00:00:00 2001 From: Ephraim Duncan <55143799+ephraimduncan@users.noreply.github.com> Date: Wed, 12 Mar 2025 05:05:45 +0000 Subject: [PATCH] fix: correct signer deletion (#1596) --- packages/ui/primitives/document-flow/add-signers.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/ui/primitives/document-flow/add-signers.tsx b/packages/ui/primitives/document-flow/add-signers.tsx index ce86cff42..72b1f0b5b 100644 --- a/packages/ui/primitives/document-flow/add-signers.tsx +++ b/packages/ui/primitives/document-flow/add-signers.tsx @@ -201,10 +201,12 @@ export const AddSignersFormPartial = ({ return; } - removeSigner(index); - - const updatedSigners = signers.filter((_, idx) => idx !== index); - form.setValue('signers', normalizeSigningOrders(updatedSigners)); + const formStateIndex = form.getValues('signers').findIndex((s) => s.formId === signer.formId); + if (formStateIndex !== -1) { + removeSigner(formStateIndex); + const updatedSigners = form.getValues('signers').filter((s) => s.formId !== signer.formId); + form.setValue('signers', normalizeSigningOrders(updatedSigners)); + } }; const onAddSelfSigner = () => {