fix: performance issues when focusing node

This commit is contained in:
liujuping 2022-11-17 12:02:19 +08:00 committed by LeoYuan 袁力皓
parent 268fbe949b
commit bcaad576b3

View File

@ -399,10 +399,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
/** 监听参数变化 */
initOnPropsChangeEvent(leaf = this.leaf): void {
const dispose = leaf?.onPropChange?.((propChangeInfo: PropChangeOptions) => {
if (!this.autoRepaintNode) {
return;
}
const handlePropsChange = debounce((propChangeInfo: PropChangeOptions) => {
const {
key,
newValue = null,
@ -450,6 +447,12 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
this.judgeMiniUnitRender();
});
const dispose = leaf?.onPropChange?.((propChangeInfo: PropChangeOptions) => {
if (!this.autoRepaintNode) {
return;
}
handlePropsChange(propChangeInfo);
});
dispose && this.disposeFunctions.push(dispose);
}