mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 09:41:57 +00:00
refactor(perf): 修复首次渲染隐藏模态框带来的重复渲染性能消耗
chore: 关闭 liveReload fix: 修复 history.savePoint 的延迟调用逻辑
This commit is contained in:
parent
70843912ea
commit
c463b73580
@ -32,7 +32,7 @@ export class ModalNodesManager {
|
||||
this.emitter = new EventEmitter();
|
||||
this.nodeRemoveEvents = {};
|
||||
this.setNodes();
|
||||
this.hideModalNodes();
|
||||
// this.hideModalNodes();
|
||||
this.willDestroy = [
|
||||
page.onNodeCreate((node) => this.addNode(node)),
|
||||
page.onNodeDestroy((node) => this.removeNode(node)),
|
||||
|
||||
@ -166,6 +166,9 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
});
|
||||
this.settingEntry = this.document.designer.createSettingEntry([this]);
|
||||
} else {
|
||||
if (this.componentMeta.isModal) {
|
||||
extras.hidden = true;
|
||||
}
|
||||
// 这里 props 被初始化两次,一次 new,一次 import,new 的实例需要给 propsReducer 的钩子去使用,
|
||||
// import 是为了使用钩子返回的值,并非完全幂等的操作,部分行为执行两次会有 bug,
|
||||
// 所以在 props 里会对 new / import 做一些区别化的解析
|
||||
@ -802,20 +805,13 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
}
|
||||
|
||||
insertBefore(node: Node, ref?: Node, useMutator = true) {
|
||||
this.children?.insert(node, ref ? ref.index : null, useMutator);
|
||||
const nodeInstance = ensureNode(node, this.document);
|
||||
this.children?.insert(nodeInstance, ref ? ref.index : null, useMutator);
|
||||
}
|
||||
|
||||
insertAfter(node: any, ref?: Node, useMutator = true) {
|
||||
if (!isNode(node)) {
|
||||
if (node.getComponentName) {
|
||||
node = this.document.createNode({
|
||||
componentName: node.getComponentName(),
|
||||
});
|
||||
} else {
|
||||
node = this.document.createNode(node);
|
||||
}
|
||||
}
|
||||
this.children?.insert(node, ref ? ref.index + 1 : null, useMutator);
|
||||
const nodeInstance = ensureNode(node, this.document);
|
||||
this.children?.insert(nodeInstance, ref ? ref.index + 1 : null, useMutator);
|
||||
}
|
||||
|
||||
getParent() {
|
||||
@ -1001,6 +997,20 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
}
|
||||
}
|
||||
|
||||
function ensureNode(node: any, document: DocumentModel): Node {
|
||||
let nodeInstance = node;
|
||||
if (!isNode(node)) {
|
||||
if (node.getComponentName) {
|
||||
nodeInstance = document.createNode({
|
||||
componentName: node.getComponentName(),
|
||||
});
|
||||
} else {
|
||||
nodeInstance = document.createNode(node);
|
||||
}
|
||||
}
|
||||
return nodeInstance;
|
||||
}
|
||||
|
||||
export interface ParentalNode<T extends NodeSchema = NodeSchema> extends Node<T> {
|
||||
readonly children: NodeChildren;
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
},
|
||||
"vendor": false,
|
||||
"devServer": {
|
||||
"useLocalIp": true,
|
||||
"liveReload": false,
|
||||
"hot": false
|
||||
},
|
||||
"publicPath": "/",
|
||||
|
||||
@ -74,10 +74,7 @@ const pages = Object.assign(project, {
|
||||
true,
|
||||
);
|
||||
|
||||
// FIXME: 根本原因应该是 propStash 导致的,这样可以避免页面加载之后就被标记为 isModified
|
||||
setTimeout(() => {
|
||||
project.currentDocument?.history.savePoint();
|
||||
}, 0);
|
||||
project.currentDocument?.history.savePoint();
|
||||
},
|
||||
addPage(data: OldPageData | RootSchema) {
|
||||
if (isPageDataV1(data)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user