mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 18:42:56 +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 dispose: IPublicTypeDisposable;
|
||||
private simulatorRendererReadyDispose: IPublicTypeDisposable;
|
||||
private changeDocumentDispose: IPublicTypeDisposable;
|
||||
private removeDocumentDispose: IPublicTypeDisposable;
|
||||
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
@ -26,16 +28,22 @@ export class Pane extends PureComponent<{
|
||||
this.state = {
|
||||
tree: treeMaster.currentTree,
|
||||
};
|
||||
this.dispose = this.props.treeMaster.pluginContext?.project?.onSimulatorRendererReady(() => {
|
||||
this.setState({
|
||||
tree: this.props.treeMaster.currentTree,
|
||||
});
|
||||
});
|
||||
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({
|
||||
tree: this.props.treeMaster.currentTree,
|
||||
});
|
||||
};
|
||||
|
||||
componentWillUnmount() {
|
||||
this.controller.purge();
|
||||
this.dispose && this.dispose();
|
||||
this.simulatorRendererReadyDispose?.();
|
||||
this.changeDocumentDispose?.();
|
||||
this.removeDocumentDispose?.();
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user