Skip to content

Commit

Permalink
Merge pull request #69 from brown-ccv/fix-data-table-select
Browse files Browse the repository at this point in the history
fix: checking all works via updated state
  • Loading branch information
hetd54 committed Jul 2, 2024
2 parents 7c4e807 + 06adbb1 commit 540dcdf
Showing 1 changed file with 6 additions and 6 deletions.
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

0 comments on commit 540dcdf

Please sign in to comment.