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) =>
|
||||
selectedCombinations.includes(childPath)
|
||||
)
|
||||
setIsIndeterminate(
|
||||
anyChildCombinationSelected && !selectedCombinations.includes(pathString)
|
||||
const anyChildCombinationLinked = childPaths.some(
|
||||
(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 = () => {
|
||||
setIsSingleChecked(!isSingleChecked)
|
||||
|
Loading…
x
Reference in New Issue
Block a user