fix: ensure duplicated fields do not retain the original fields id
This commit is contained in:
@@ -429,6 +429,7 @@ export const AddFieldsFormPartial = ({
|
|||||||
|
|
||||||
const newField: TAddFieldsFormSchema['fields'][0] = {
|
const newField: TAddFieldsFormSchema['fields'][0] = {
|
||||||
...structuredClone(lastActiveField),
|
...structuredClone(lastActiveField),
|
||||||
|
nativeId: undefined,
|
||||||
formId: nanoid(12),
|
formId: nanoid(12),
|
||||||
signerEmail: selectedSigner?.email ?? lastActiveField.signerEmail,
|
signerEmail: selectedSigner?.email ?? lastActiveField.signerEmail,
|
||||||
pageX: lastActiveField.pageX + 3,
|
pageX: lastActiveField.pageX + 3,
|
||||||
@@ -450,6 +451,7 @@ export const AddFieldsFormPartial = ({
|
|||||||
|
|
||||||
append({
|
append({
|
||||||
...copiedField,
|
...copiedField,
|
||||||
|
nativeId: undefined,
|
||||||
formId: nanoid(12),
|
formId: nanoid(12),
|
||||||
signerEmail: selectedSigner?.email ?? copiedField.signerEmail,
|
signerEmail: selectedSigner?.email ?? copiedField.signerEmail,
|
||||||
pageX: copiedField.pageX + 3,
|
pageX: copiedField.pageX + 3,
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ export const AddTemplateFieldsFormPartial = ({
|
|||||||
const newField: TAddTemplateFieldsFormSchema['fields'][0] = {
|
const newField: TAddTemplateFieldsFormSchema['fields'][0] = {
|
||||||
...structuredClone(lastActiveField),
|
...structuredClone(lastActiveField),
|
||||||
formId: nanoid(12),
|
formId: nanoid(12),
|
||||||
|
nativeId: undefined,
|
||||||
signerEmail: selectedSigner?.email ?? lastActiveField.signerEmail,
|
signerEmail: selectedSigner?.email ?? lastActiveField.signerEmail,
|
||||||
signerId: selectedSigner?.id ?? lastActiveField.signerId,
|
signerId: selectedSigner?.id ?? lastActiveField.signerId,
|
||||||
signerToken: selectedSigner?.token ?? lastActiveField.signerToken,
|
signerToken: selectedSigner?.token ?? lastActiveField.signerToken,
|
||||||
@@ -195,6 +196,7 @@ export const AddTemplateFieldsFormPartial = ({
|
|||||||
append({
|
append({
|
||||||
...copiedField,
|
...copiedField,
|
||||||
formId: nanoid(12),
|
formId: nanoid(12),
|
||||||
|
nativeId: undefined,
|
||||||
signerEmail: selectedSigner?.email ?? copiedField.signerEmail,
|
signerEmail: selectedSigner?.email ?? copiedField.signerEmail,
|
||||||
signerId: selectedSigner?.id ?? copiedField.signerId,
|
signerId: selectedSigner?.id ?? copiedField.signerId,
|
||||||
signerToken: selectedSigner?.token ?? copiedField.signerToken,
|
signerToken: selectedSigner?.token ?? copiedField.signerToken,
|
||||||
@@ -483,12 +485,6 @@ export const AddTemplateFieldsFormPartial = ({
|
|||||||
form.setValue('fields', updatedFields);
|
form.setValue('fields', updatedFields);
|
||||||
};
|
};
|
||||||
|
|
||||||
const isTypedSignatureEnabled = form.watch('typedSignatureEnabled');
|
|
||||||
|
|
||||||
const handleTypedSignatureChange = (value: boolean) => {
|
|
||||||
form.setValue('typedSignatureEnabled', value, { shouldDirty: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{showAdvancedSettings && currentField ? (
|
{showAdvancedSettings && currentField ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user