Fixed error due to same values.
This commit is contained in:
parent
5d6fe05227
commit
9255f6bbe8
@ -98,10 +98,11 @@ const ObjectSelect = ({
|
|||||||
const newFilterPath = filterPath.concat({ property, value: key })
|
const newFilterPath = filterPath.concat({ property, value: key })
|
||||||
return {
|
return {
|
||||||
title: <ObjectProperty type={property} value={key} />,
|
title: <ObjectProperty type={property} value={key} />,
|
||||||
value: key,
|
value: parentKeys.concat(key).join('-'),
|
||||||
key: parentKeys.concat(key).join(':'),
|
filterValue: key,
|
||||||
|
key: parentKeys.concat(key).join('-'),
|
||||||
property,
|
property,
|
||||||
parentKeys: parentKeys.concat(key || ':'),
|
parentKeys: parentKeys.concat(key || '-'),
|
||||||
filterPath: newFilterPath,
|
filterPath: newFilterPath,
|
||||||
selectable: false,
|
selectable: false,
|
||||||
children: buildTreeData(
|
children: buildTreeData(
|
||||||
@ -131,7 +132,7 @@ const ObjectSelect = ({
|
|||||||
customFilter[property] = value
|
customFilter[property] = value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
customFilter[node.property] = node.value
|
customFilter[node.property] = node.filterValue
|
||||||
// Fetch children for this node
|
// Fetch children for this node
|
||||||
const data = await handleFetchObjectsProperties(customFilter)
|
const data = await handleFetchObjectsProperties(customFilter)
|
||||||
if (!data) return
|
if (!data) return
|
||||||
@ -141,14 +142,14 @@ const ObjectSelect = ({
|
|||||||
// If the API returns an object with multiple keys, get only the data for this node
|
// If the API returns an object with multiple keys, get only the data for this node
|
||||||
nodeSpecificData = data[node.value] || {}
|
nodeSpecificData = data[node.value] || {}
|
||||||
}
|
}
|
||||||
// Build new children only for this specific node
|
// Build new tree children only for this specific node
|
||||||
const children = buildTreeData(
|
const treeChildren = buildTreeData(
|
||||||
nodeSpecificData,
|
nodeSpecificData,
|
||||||
properties.indexOf(node.property) + 1,
|
properties.indexOf(node.property) + 1,
|
||||||
node.parentKeys || [],
|
node.parentKeys || [],
|
||||||
(node.filterPath || []).concat({
|
(node.filterPath || []).concat({
|
||||||
property: node.property,
|
property: node.property,
|
||||||
value: node.value
|
value: node.filterValue
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
// Update treeData with new children for this node only
|
// Update treeData with new children for this node only
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user