From 6ab2925d5f8e94a15ee6f9ea2d919514c2c99004 Mon Sep 17 00:00:00 2001 From: Maicol Battistini Date: Tue, 15 Feb 2022 12:05:43 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20Aggiunta=20opzione=20vuota=20se=20la=20s?= =?UTF-8?q?elect=20=C3=A8=20facoltativa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/js/Components/Pages/RecordsPage.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/js/Components/Pages/RecordsPage.tsx b/resources/js/Components/Pages/RecordsPage.tsx index 14e4707fd..0de5de6db 100644 --- a/resources/js/Components/Pages/RecordsPage.tsx +++ b/resources/js/Components/Pages/RecordsPage.tsx @@ -613,9 +613,14 @@ export class RecordsPage extends Page { .first(); const select = section.fields[field.id] as SelectT; - let {options} = select; + // eslint-disable-next-line prefer-const + let {options, required} = select; const {relationship} = select; + if (!required) { + list.push(); + } + if (Array.isArray(relationship) && relationship.length === 2) { options = this.getModelSelectOptions(relationship[0], relationship[1]); }