Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

fix: checking all works via updated state #69

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/components/DataForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ const DataForm: React.FC<DataFormProps> = ({ allFiles }) => {
* with the new value for `selected`.
*/
const updateFileList = ({ file: targetFile }: FileItem, selection: boolean) => {
const updatedFiles = files.map(({ file, selected, ...rest }) => {
return file === targetFile
? { file, selected: selection, ...rest }
: { file, selected, ...rest }
setFiles((prevFiles) => {
return prevFiles.map(({ file, selected, ...rest }) => {
return file === targetFile
? { file, selected: selection, ...rest }
: { file, selected, ...rest }
})
})

setFiles(updatedFiles)
}

return (
Expand Down