From c68eb4f198ad28dd5479d6e298a1b360dd4cb3aa Mon Sep 17 00:00:00 2001 From: Ephraim Atta-Duncan Date: Tue, 4 Mar 2025 11:57:09 +0000 Subject: [PATCH] fix: ensure duplicated fields do not retain the original fields id --- packages/ui/primitives/document-flow/add-fields.tsx | 2 ++ .../ui/primitives/template-flow/add-template-fields.tsx | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/ui/primitives/document-flow/add-fields.tsx b/packages/ui/primitives/document-flow/add-fields.tsx index abbb67916..0e79dc56b 100644 --- a/packages/ui/primitives/document-flow/add-fields.tsx +++ b/packages/ui/primitives/document-flow/add-fields.tsx @@ -429,6 +429,7 @@ export const AddFieldsFormPartial = ({ const newField: TAddFieldsFormSchema['fields'][0] = { ...structuredClone(lastActiveField), + nativeId: undefined, formId: nanoid(12), signerEmail: selectedSigner?.email ?? lastActiveField.signerEmail, pageX: lastActiveField.pageX + 3, @@ -450,6 +451,7 @@ export const AddFieldsFormPartial = ({ append({ ...copiedField, + nativeId: undefined, formId: nanoid(12), signerEmail: selectedSigner?.email ?? copiedField.signerEmail, pageX: copiedField.pageX + 3, diff --git a/packages/ui/primitives/template-flow/add-template-fields.tsx b/packages/ui/primitives/template-flow/add-template-fields.tsx index 88ae949f2..4db29606b 100644 --- a/packages/ui/primitives/template-flow/add-template-fields.tsx +++ b/packages/ui/primitives/template-flow/add-template-fields.tsx @@ -165,6 +165,7 @@ export const AddTemplateFieldsFormPartial = ({ const newField: TAddTemplateFieldsFormSchema['fields'][0] = { ...structuredClone(lastActiveField), formId: nanoid(12), + nativeId: undefined, signerEmail: selectedSigner?.email ?? lastActiveField.signerEmail, signerId: selectedSigner?.id ?? lastActiveField.signerId, signerToken: selectedSigner?.token ?? lastActiveField.signerToken, @@ -195,6 +196,7 @@ export const AddTemplateFieldsFormPartial = ({ append({ ...copiedField, formId: nanoid(12), + nativeId: undefined, signerEmail: selectedSigner?.email ?? copiedField.signerEmail, signerId: selectedSigner?.id ?? copiedField.signerId, signerToken: selectedSigner?.token ?? copiedField.signerToken, @@ -483,12 +485,6 @@ export const AddTemplateFieldsFormPartial = ({ form.setValue('fields', updatedFields); }; - const isTypedSignatureEnabled = form.watch('typedSignatureEnabled'); - - const handleTypedSignatureChange = (value: boolean) => { - form.setValue('typedSignatureEnabled', value, { shouldDirty: true }); - }; - return ( <> {showAdvancedSettings && currentField ? (