mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +00:00
fix: 修复切换 document 时报错
This commit is contained in:
parent
06491f90fa
commit
1ad2749c97
@ -140,7 +140,7 @@ export class OutlineMain implements ISensor, ITreeBoard, IScrollable {
|
||||
const { nodes } = dragObject;
|
||||
|
||||
const tree = this._master?.currentTree;
|
||||
if (!tree || !this._shell) {
|
||||
if (!tree || !tree.root || !this._shell) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -7,8 +7,11 @@ export class Tree {
|
||||
|
||||
readonly id: string;
|
||||
|
||||
@computed get root(): TreeNode {
|
||||
return this.getTreeNode(this.document.focusNode!);
|
||||
@computed get root(): TreeNode | null {
|
||||
if (this.document.focusNode) {
|
||||
return this.getTreeNode(this.document.focusNode!);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
constructor(readonly document: DocumentModel) {
|
||||
|
||||
@ -150,6 +150,9 @@ export default class TreeView extends Component<{ tree: Tree }> {
|
||||
render() {
|
||||
const { tree } = this.props;
|
||||
const { root } = tree;
|
||||
if (!root) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div
|
||||
className="lc-outline-tree"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user