mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 11:20:11 +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 {
|
||||
const dispose = leaf?.onPropChange?.((propChangeInfo: PropChangeOptions) => {
|
||||
const dispose = leaf?.onPropChange?.(debounce((propChangeInfo: PropChangeOptions) => {
|
||||
const {
|
||||
key,
|
||||
newValue = null,
|
||||
@ -433,7 +433,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
|
||||
});
|
||||
|
||||
this.judgeMiniUnitRender();
|
||||
});
|
||||
}, 30));
|
||||
|
||||
dispose && this.disposeFunctions.push(dispose);
|
||||
}
|
||||
|
||||
@ -16,8 +16,8 @@ jest.mock('lodash', () => {
|
||||
|
||||
return {
|
||||
...original,
|
||||
debounce: (fn) => () => fn(),
|
||||
throttle: (fn) => () => fn(),
|
||||
debounce: (fn) => (...args: any[]) => fn.apply(this, args),
|
||||
throttle: (fn) => (...args: any[]) => fn.apply(this, args),
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user