Properties add shouldUpdate

This commit is contained in:
zhandouxiaojiji committed 2020-10-21 21:21:58 +08:00
1 parent aefb646793
commit 1d1c6fded2
1 file changed
+9
+9
View File
@@ -28,6 +28,14 @@ export default class Properties extends Component<PropertiesProps> {
treeList: []
};
curWorkspace: string = '';
shouldComponentUpdate(nextProps: PropertiesProps) {
const shouldUpdate = this.curWorkspace != nextProps.workspace;
this.curWorkspace = nextProps.workspace;
return shouldUpdate;
}
componentDidMount() {
var workspace = this.props.workspace;
if (workspace == '') {
@@ -58,6 +66,7 @@ export default class Properties extends Component<PropertiesProps> {
}
render() {
console.log("render Properties");
const { onOpenTree, workspace } = this.props;
const treeList = this.getTreeList(workspace);
return (