Skip to content

Commit

Permalink
Fiks for #1310
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi749 committed Nov 7, 2023
1 parent 8fa72c8 commit b2f0ea5
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ export function useFilter(props: IFilterProps) {
* @param checked Item checked
*/
const onChange = (item: IFilterItemProps, checked: boolean) => {
setState((prevState) => {
const items = prevState.items.map((i) => {
if (i.value === item.value) {
return { ...i, selected: checked }
}
return i
})
return { ...prevState, items }
const items = state.items.map((i) => {
if (i.value === item.value) {
return { ...i, selected: checked }
}
return i
})
const selectedItems = state.items.filter(({ selected }) => selected)

setState((prevState) => ({ ...prevState, items }))
const selectedItems = items.filter(({ selected }) => selected)
props.onFilterChange(props.column, selectedItems)
}

Expand Down

0 comments on commit b2f0ea5

Please sign in to comment.