mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 14:04:28 +00:00
refactor(perf): 解决内存泄漏问题, 回收 setting-top-entry, 断开 setting-field 父子之间的互相引用关系
This commit is contained in:
parent
6a1af9d729
commit
5b64850bd5
@ -58,10 +58,13 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
|
|||||||
this._expanded = value;
|
this._expanded = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(readonly parent: SettingEntry, config: FieldConfig, settingFieldCollector?: (name: string | number, field: SettingField) => void) {
|
parent: SettingEntry;
|
||||||
|
|
||||||
|
constructor(parent: SettingEntry, config: FieldConfig, settingFieldCollector?: (name: string | number, field: SettingField) => void) {
|
||||||
super(parent, config.name, config.type);
|
super(parent, config.name, config.type);
|
||||||
|
|
||||||
const { title, items, setter, extraProps, ...rest } = config;
|
const { title, items, setter, extraProps, ...rest } = config;
|
||||||
|
this.parent = parent;
|
||||||
this._config = config;
|
this._config = config;
|
||||||
this._title = title;
|
this._title = title;
|
||||||
this._setter = setter;
|
this._setter = setter;
|
||||||
@ -115,6 +118,7 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
|
|||||||
|
|
||||||
purge() {
|
purge() {
|
||||||
this.disposeItems();
|
this.disposeItems();
|
||||||
|
this.parent = null as any;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ======= compatibles for vision ======
|
// ======= compatibles for vision ======
|
||||||
|
|||||||
@ -69,6 +69,7 @@ export class SettingsMain {
|
|||||||
this.designer = nodes[0].document.designer;
|
this.designer = nodes[0].document.designer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._settings?.purge();
|
||||||
this._settings = this.designer.createSettingEntry(nodes);
|
this._settings = this.designer.createSettingEntry(nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user