From 5abfdf14fd8baa40cdcc6b048144c4b60c445f83 Mon Sep 17 00:00:00 2001 From: andrzej Date: Wed, 24 Jul 2024 22:01:20 +0200 Subject: [PATCH] give each genrePicker cell a unique form id --- src/app/ui/tables/inputs/genrePickerInput.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/ui/tables/inputs/genrePickerInput.tsx b/src/app/ui/tables/inputs/genrePickerInput.tsx index ddedd5f..8ecdb5f 100644 --- a/src/app/ui/tables/inputs/genrePickerInput.tsx +++ b/src/app/ui/tables/inputs/genrePickerInput.tsx @@ -24,7 +24,7 @@ export default function GenrePickerInputCell(props: CellContext) { const genres = props.table.options.meta.genres const [isActive, setIsActive] = useState(false) - async function onSubmit({ genres }: { genres: number[] }, event: Event) { + async function onSubmit({ genres }: { genres: number[] }) { event.preventDefault() const genresArray = genres.map((e) => { return { id: e } }) console.log(`genres: ${genres}, genresArray: ${JSON.stringify(genresArray)}`) @@ -42,7 +42,7 @@ export default function GenrePickerInputCell(props: CellContext) { // genres: genresArray, // pathname // }) - // setIsActive(false) + setIsActive(false) } function onErrors(errors) { @@ -65,11 +65,14 @@ export default function GenrePickerInputCell(props: CellContext) { genres: value.map(e => e.id) } }) + + const formId = "editGenresForm" + props.cell.id + return (
- - + + setIsActive(prev => !prev)}> ) { }} /> ))} - +