From 315c71baa4c4912a47aeea8f2822e7a315394017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Sat, 24 Jan 2026 09:08:20 +0400 Subject: [PATCH] =?UTF-8?q?feat:=20denier=20titre=20publi=C3=A9=20dans=20l?= =?UTF-8?q?e=20select=20lors=20de=20la=20cr=C3=A9ation=20d'article?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/konstitisyon/create/handle-create.js | 3 ++- components/konstitisyon/create/list-items.js | 5 +++-- components/konstitisyon/form-handler.js | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/components/konstitisyon/create/handle-create.js b/components/konstitisyon/create/handle-create.js index 4bfd525..4f4cc21 100644 --- a/components/konstitisyon/create/handle-create.js +++ b/components/konstitisyon/create/handle-create.js @@ -22,7 +22,7 @@ export default function HandleCreate({ useEffect(() => { if (listItems && listItems.length > 0) { - setSelectValue(listItems[0].id) + setSelectValue(listItems.at(-1).id) } }, [listItems]) @@ -142,6 +142,7 @@ export default function HandleCreate({ collection={collection} listItems={listItems} handleFormSubmit={handleFormSubmit} + selectValue={selectValue} setSelectValue={setSelectValue} title='Article' dialogText='Écrivez votre article' diff --git a/components/konstitisyon/create/list-items.js b/components/konstitisyon/create/list-items.js index 6e88a88..5063b04 100644 --- a/components/konstitisyon/create/list-items.js +++ b/components/konstitisyon/create/list-items.js @@ -4,7 +4,7 @@ import InputLabel from '@mui/material/InputLabel' import FormControl from '@mui/material/FormControl' import NativeSelect from '@mui/material/NativeSelect' -export default function ListItems({items, selectLabel, setSelectValue}) { +export default function ListItems({items, selectLabel, selectValue, setSelectValue}) { const handleChange = event => { setSelectValue(event.target.value) } @@ -16,7 +16,7 @@ export default function ListItems({items, selectLabel, setSelectValue}) { {selectLabel} )} @@ -94,6 +96,7 @@ FormHandler.propTypes = { setError: PropTypes.func.isRequired, setIsErrorAlertOpen: PropTypes.func.isRequired, handleFormSubmit: PropTypes.func.isRequired, + selectValue: PropTypes.string, setSelectValue: PropTypes.func.isRequired, dialogText: PropTypes.string.isRequired, title: PropTypes.string.isRequired,