diff --git a/packages/core/package.json b/packages/core/package.json index 7e9932bdc1..b2d55bc6fe 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -39,6 +39,7 @@ "@types/react-sparklines": "^1.7.0", "classnames": "^2.2.6", "clsx": "^1.1.0", + "immer": "^7.0.9", "lodash": "^4.17.15", "material-table": "1.68.0", "prop-types": "^15.7.2", diff --git a/packages/core/src/components/CheckboxTree/CheckboxTree.tsx b/packages/core/src/components/CheckboxTree/CheckboxTree.tsx index 31fefda204..ed0da051c5 100644 --- a/packages/core/src/components/CheckboxTree/CheckboxTree.tsx +++ b/packages/core/src/components/CheckboxTree/CheckboxTree.tsx @@ -26,6 +26,7 @@ import { } from '@material-ui/core'; import ExpandLess from '@material-ui/icons/ExpandLess'; import ExpandMore from '@material-ui/icons/ExpandMore'; +import produce from 'immer'; type IndexedObject = { [key: string]: T; @@ -110,18 +111,7 @@ type checkOptionPayload = { type Action = | { type: 'checkOption'; payload: checkOptionPayload } | { type: 'checkCategory'; payload: string } - | { type: 'openCategory'; payload: string }; - -const checkAllOptions = ( - arr: Option[], - isChecked: boolean, -): IndexedObject