mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 11:20:11 +00:00
fix: fix the performance issue of batch call executeTransaction
This commit is contained in:
parent
b18b70461c
commit
407294dff3
@ -69,6 +69,7 @@ import { LiveEditing } from './live-editing/live-editing';
|
|||||||
import { Project } from '../project';
|
import { Project } from '../project';
|
||||||
import { Scroller } from '../designer/scroller';
|
import { Scroller } from '../designer/scroller';
|
||||||
import { isElementNode, isDOMNodeVisible } from '../utils/misc';
|
import { isElementNode, isDOMNodeVisible } from '../utils/misc';
|
||||||
|
import { debounce } from 'lodash';
|
||||||
|
|
||||||
export interface LibraryItem extends Package{
|
export interface LibraryItem extends Package{
|
||||||
package: string;
|
package: string;
|
||||||
@ -205,8 +206,10 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
transactionManager.onStartTransaction(() => {
|
transactionManager.onStartTransaction(() => {
|
||||||
this.stopAutoRepaintNode();
|
this.stopAutoRepaintNode();
|
||||||
}, TransitionType.REPAINT);
|
}, TransitionType.REPAINT);
|
||||||
|
// 防止批量调用 transaction 时,执行多次 rerender
|
||||||
|
const rerender = debounce(this.rerender.bind(this), 28);
|
||||||
transactionManager.onEndTransaction(() => {
|
transactionManager.onEndTransaction(() => {
|
||||||
this.rerender();
|
rerender();
|
||||||
this.enableAutoRepaintNode();
|
this.enableAutoRepaintNode();
|
||||||
}, TransitionType.REPAINT);
|
}, TransitionType.REPAINT);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,4 +26,4 @@ export * from './node-helper';
|
|||||||
export * from './clone-enumerable-property';
|
export * from './clone-enumerable-property';
|
||||||
export * from './logger';
|
export * from './logger';
|
||||||
export * as css from './css-helper';
|
export * as css from './css-helper';
|
||||||
export { transactionManager } from './start-transaction';
|
export { transactionManager } from './transaction-manager';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user