mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-14 04:43:14 +00:00
fix: fix outlinePane treeView render only once
This commit is contained in:
parent
059ffe0eaa
commit
8b44ed4429
@ -17,7 +17,9 @@ export class Pane extends PureComponent<{
|
|||||||
}> {
|
}> {
|
||||||
private controller;
|
private controller;
|
||||||
|
|
||||||
private dispose: IPublicTypeDisposable;
|
private simulatorRendererReadyDispose: IPublicTypeDisposable;
|
||||||
|
private changeDocumentDispose: IPublicTypeDisposable;
|
||||||
|
private removeDocumentDispose: IPublicTypeDisposable;
|
||||||
|
|
||||||
constructor(props: any) {
|
constructor(props: any) {
|
||||||
super(props);
|
super(props);
|
||||||
@ -26,16 +28,22 @@ export class Pane extends PureComponent<{
|
|||||||
this.state = {
|
this.state = {
|
||||||
tree: treeMaster.currentTree,
|
tree: treeMaster.currentTree,
|
||||||
};
|
};
|
||||||
this.dispose = this.props.treeMaster.pluginContext?.project?.onSimulatorRendererReady(() => {
|
this.simulatorRendererReadyDispose = this.props.treeMaster.pluginContext?.project?.onSimulatorRendererReady(this.changeTree);
|
||||||
|
this.changeDocumentDispose = this.props.treeMaster.pluginContext?.project?.onChangeDocument(this.changeTree);
|
||||||
|
this.removeDocumentDispose = this.props.treeMaster.pluginContext?.project?.onRemoveDocument(this.changeTree);
|
||||||
|
}
|
||||||
|
|
||||||
|
changeTree = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
tree: this.props.treeMaster.currentTree,
|
tree: this.props.treeMaster.currentTree,
|
||||||
});
|
});
|
||||||
});
|
};
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.controller.purge();
|
this.controller.purge();
|
||||||
this.dispose && this.dispose();
|
this.simulatorRendererReadyDispose?.();
|
||||||
|
this.changeDocumentDispose?.();
|
||||||
|
this.removeDocumentDispose?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user