From 1d1c6fded2946f77d69653ade065b46e6b5cc501 Mon Sep 17 00:00:00 2001 From: zhandouxiaojiji Date: Wed, 21 Oct 2020 21:21:58 +0800 Subject: [PATCH] Properties add shouldUpdate --- render-process/Properties.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/render-process/Properties.tsx b/render-process/Properties.tsx index 62c03ee..42c419d 100644 --- a/render-process/Properties.tsx +++ b/render-process/Properties.tsx @@ -28,6 +28,14 @@ export default class Properties extends Component { 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 { } render() { + console.log("render Properties"); const { onOpenTree, workspace } = this.props; const treeList = this.getTreeList(workspace); return (