fix: fix array to tree when parentNode is null

This commit is contained in:
fantasticit 2022-03-19 11:32:12 +08:00
parent 0970b00cb1
commit 0353d20dcf
2 changed files with 2 additions and 1 deletions

View File

@ -16,6 +16,7 @@ export function array2tree(list) {
list[map[node.parentDocumentId]].children.push(node); list[map[node.parentDocumentId]].children.push(node);
} else { } else {
node.parentDocumentId = null; // 该节点的父节点无法访问 node.parentDocumentId = null; // 该节点的父节点无法访问
roots.push(node);
} }
} else { } else {
roots.push(node); roots.push(node);

View File

@ -816,7 +816,7 @@ export class DocumentService {
delete doc.state; delete doc.state;
}); });
return array2tree(docs.map((doc) => instanceToPlain(doc))); return array2tree(docs);
} }
/** /**