From b2f66c969766ec76e39808560fe5cda72b9a3494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Huchet?= Date: Fri, 16 Feb 2024 11:38:45 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20d'import=20de=20config=20pour=20ne?= =?UTF-8?q?=20pas=20cr=C3=A9er=20deux=20champs=20avec=20un=20m=C3=AAme=20i?= =?UTF-8?q?dentifiant=20(#7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dashboard/src/scenes/data-import-export/ImportConfig.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dashboard/src/scenes/data-import-export/ImportConfig.tsx b/dashboard/src/scenes/data-import-export/ImportConfig.tsx index 11dd7c99a..14e634c2b 100644 --- a/dashboard/src/scenes/data-import-export/ImportConfig.tsx +++ b/dashboard/src/scenes/data-import-export/ImportConfig.tsx @@ -2,6 +2,7 @@ import { MutableRefObject, useRef, useState } from 'react'; import { utils, read, writeFile, WorkBook } from 'xlsx'; import { toast } from 'react-toastify'; import { useRecoilState, useRecoilValue } from 'recoil'; +import { v4 as uuidv4 } from 'uuid'; import ButtonCustom from '../../components/ButtonCustom'; import { customFieldsPersonsSelector } from '../../recoil/persons'; import { newCustomField, typeOptions } from '../../utils'; @@ -446,6 +447,7 @@ function processConfigWorkbook(workbook: WorkBook): WorkbookData { function mergerFieldWithPrevious(field: Partial, previousField?: CustomField): CustomField { return { ...(newCustomField() as CustomField), + name: `custom-${new Date().toISOString().split('.').join('-').split(':').join('-')}-${uuidv4()}`, ...field, ...(previousField ? { enabled: previousField.enabled } : {}), ...(previousField ? { required: previousField.required } : {}),