chore: fix ordering of recipients

Signed-off-by: Adithya Krishna <aadithya794@gmail.com>
This commit is contained in:
Adithya Krishna
2024-04-17 02:24:48 +05:30
parent 7705dbae0c
commit 9715dbfeaa

View File

@ -80,6 +80,7 @@ export const AddTemplatePlaceholderRecipientsFormPartial = ({
append: appendSigner,
fields: signers,
remove: removeSigner,
update: updateSigner,
} = useFieldArray({
control,
name: 'signers',
@ -97,7 +98,15 @@ export const AddTemplatePlaceholderRecipientsFormPartial = ({
};
const onRemoveSigner = (index: number) => {
for (let i = index; i < signers.length; i++) {
updateSigner(i, {
...signers[i],
name: `Recipient ${i}`,
email: `recipient.${i}@documenso.com`,
});
}
removeSigner(index);
setPlaceholderRecipientCount((count) => count - 1);
};
return (