mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-25 01:43:27 +08:00
refa: improve tree clustering (#17285)
This commit is contained in:
@@ -142,7 +142,7 @@ const TreeItem = React.forwardRef<HTMLDivElement, TreeItemProps>(
|
||||
<ul>
|
||||
{data.map((item) => (
|
||||
<li key={item.id}>
|
||||
{item.children ? (
|
||||
{item.children && item.children.length > 0 ? (
|
||||
<TreeNode
|
||||
item={item}
|
||||
selectedItemId={selectedItemId}
|
||||
|
||||
@@ -48,6 +48,11 @@ function buildTreeDataItems(
|
||||
|
||||
for (const relation of relations) {
|
||||
if (!relationTypes.includes(relation.type ?? '')) continue;
|
||||
// Self-referencing relation (same entity as its own child) creates
|
||||
// an infinite recursion in the tree renderer. This is a backend
|
||||
// data integrity issue (duplicate entity names) but we defend
|
||||
// against it in the frontend so the UI never hangs.
|
||||
if (relation.from === relation.to) continue;
|
||||
|
||||
const parent = map.get(relation.from);
|
||||
const child = map.get(relation.to);
|
||||
|
||||
Reference in New Issue
Block a user