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 { initOnPropsChangeEvent(leaf = this.leaf): void {
const dispose = leaf?.onPropChange?.((propChangeInfo: PropChangeOptions) => { const handlePropsChange = debounce((propChangeInfo: PropChangeOptions) => {
if (!this.autoRepaintNode) {
return;
}
const { const {
key, key,
newValue = null, newValue = null,
@ -450,6 +447,12 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
this.judgeMiniUnitRender(); this.judgeMiniUnitRender();
}); });
const dispose = leaf?.onPropChange?.((propChangeInfo: PropChangeOptions) => {
if (!this.autoRepaintNode) {
return;
}
handlePropsChange(propChangeInfo);
});
dispose && this.disposeFunctions.push(dispose); dispose && this.disposeFunctions.push(dispose);
} }