mirror of
https://github.com/directus/directus.git
synced 2026-01-28 18:18:10 -05:00
Fix branch emitter logic from grand-to-child (#7763)
This commit is contained in:
@@ -324,16 +324,25 @@ export default defineComponent({
|
||||
props.modelValue.includes(props.value) &&
|
||||
allChildrenRecursive.some((childVal) => rawValue.includes(childVal))
|
||||
) {
|
||||
const childThatContainsSelection = props.children.find((child) => {
|
||||
const childNestedValues = getRecursiveChildrenValues('all', child[props.itemChildren]);
|
||||
return rawValue.some((rawVal) => childNestedValues.includes(rawVal)) === true;
|
||||
});
|
||||
|
||||
const newValue = [
|
||||
...rawValue.filter((val) => val !== props.value),
|
||||
...(props.children || [])
|
||||
.filter((child) => {
|
||||
if (!child[props.itemChildren]) return true;
|
||||
|
||||
const childNestedValues = getRecursiveChildrenValues('all', child[props.itemChildren]);
|
||||
return rawValue.some((rawVal) => childNestedValues.includes(rawVal)) === false;
|
||||
return child[props.itemValue] !== childThatContainsSelection?.[props.itemValue];
|
||||
})
|
||||
.map((child) => child[props.itemValue]),
|
||||
...(childThatContainsSelection?.[props.itemChildren] ?? [])
|
||||
.filter((grandChild: Record<string, any>) => {
|
||||
const childNestedValues = getRecursiveChildrenValues('all', grandChild[props.itemChildren]);
|
||||
return rawValue.some((rawVal) => childNestedValues.includes(rawVal)) === false;
|
||||
})
|
||||
.map((grandChild: Record<string, any>) => grandChild[props.itemValue]),
|
||||
];
|
||||
|
||||
return emitValue(newValue);
|
||||
|
||||
Reference in New Issue
Block a user