mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 19:52:51 +00:00
refactor: debounce leaf rerender, leaf will rerender too many times while creating new prop instance
This commit is contained in:
parent
51aca3d330
commit
ef3a540910
@ -386,7 +386,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
|
|||||||
|
|
||||||
/** 监听参数变化 */
|
/** 监听参数变化 */
|
||||||
initOnPropsChangeEvent(leaf = this.leaf): void {
|
initOnPropsChangeEvent(leaf = this.leaf): void {
|
||||||
const dispose = leaf?.onPropChange?.((propChangeInfo: PropChangeOptions) => {
|
const dispose = leaf?.onPropChange?.(debounce((propChangeInfo: PropChangeOptions) => {
|
||||||
const {
|
const {
|
||||||
key,
|
key,
|
||||||
newValue = null,
|
newValue = null,
|
||||||
@ -433,7 +433,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.judgeMiniUnitRender();
|
this.judgeMiniUnitRender();
|
||||||
});
|
}, 30));
|
||||||
|
|
||||||
dispose && this.disposeFunctions.push(dispose);
|
dispose && this.disposeFunctions.push(dispose);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,8 @@ jest.mock('lodash', () => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...original,
|
...original,
|
||||||
debounce: (fn) => () => fn(),
|
debounce: (fn) => (...args: any[]) => fn.apply(this, args),
|
||||||
throttle: (fn) => () => fn(),
|
throttle: (fn) => (...args: any[]) => fn.apply(this, args),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user