From ef1d4ed0fac8e53c55987199426cef26da65b56e Mon Sep 17 00:00:00 2001 From: Catalin Pit <25515812+catalinpit@users.noreply.github.com> Date: Thu, 11 Apr 2024 13:25:54 +0300 Subject: [PATCH] fix: make sure the user can't add its details more than once --- .../template-flow/add-template-placeholder-recipients.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx b/packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx index df7eb6193..642e76031 100644 --- a/packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx +++ b/packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx @@ -49,6 +49,8 @@ export const AddTemplatePlaceholderRecipientsFormPartial = ({ recipients.length > 1 ? recipients.length + 1 : 2, ); + const userIsSelfRecipient = () => signers.some((signer) => signer.email === user?.email); + const { currentStep, totalSteps, previousStep } = useStep(); const { @@ -115,9 +117,11 @@ export const AddTemplatePlaceholderRecipientsFormPartial = ({ }; const onRemoveSigner = (index: number) => { + const isSelfSigner = signers[index].formId === selfSignerFormId; + removeSigner(index); - if (signers[index].formId === selfSignerFormId) { + if (isSelfSigner) { setSelfSignerFormId(undefined); } }; @@ -238,7 +242,7 @@ export const AddTemplatePlaceholderRecipientsFormPartial = ({