fix(category): show indeterminate on linked category parents
This commit is contained in:
parent
52f1735d40
commit
70c15dceb0
@ -405,10 +405,22 @@ const CategoryCheckbox: React.FC<CategoryCheckboxProps> = ({
|
|||||||
const anyChildCombinationSelected = childPaths.some((childPath) =>
|
const anyChildCombinationSelected = childPaths.some((childPath) =>
|
||||||
selectedCombinations.includes(childPath)
|
selectedCombinations.includes(childPath)
|
||||||
)
|
)
|
||||||
setIsIndeterminate(
|
const anyChildCombinationLinked = childPaths.some(
|
||||||
anyChildCombinationSelected && !selectedCombinations.includes(pathString)
|
(childPath) =>
|
||||||
|
linkedHierarchy !== null && linkedHierarchy.includes(childPath)
|
||||||
)
|
)
|
||||||
}, [category, name, path, selectedCombinations, selectedSingles])
|
setIsIndeterminate(
|
||||||
|
(anyChildCombinationSelected || anyChildCombinationLinked) &&
|
||||||
|
!selectedCombinations.includes(pathString)
|
||||||
|
)
|
||||||
|
}, [
|
||||||
|
category,
|
||||||
|
linkedHierarchy,
|
||||||
|
name,
|
||||||
|
path,
|
||||||
|
selectedCombinations,
|
||||||
|
selectedSingles
|
||||||
|
])
|
||||||
|
|
||||||
const handleSingleChange = () => {
|
const handleSingleChange = () => {
|
||||||
setIsSingleChecked(!isSingleChecked)
|
setIsSingleChecked(!isSingleChecked)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user