Revert "fix: 修复 patch 逻辑新拖入节点可能不会执行的问题 (#8793)"

This reverts commit 4dec74d3e4.
This commit is contained in:
liaoxuezhi 2023-11-27 11:36:31 +08:00 committed by GitHub
parent 7d28608d0d
commit 80ce8dac9c
3 changed files with 3 additions and 8 deletions

View File

@ -1751,14 +1751,11 @@ export class EditorManager {
}); });
patching = false; patching = false;
patchingInvalid = false;
patchSchema(force = false) { patchSchema(force = false) {
if (this.patching) { if (this.patching) {
this.patchingInvalid = true;
return; return;
} }
this.patching = true; this.patching = true;
this.patchingInvalid = false;
let patchList = (list: Array<EditorNodeType>) => { let patchList = (list: Array<EditorNodeType>) => {
// 深度优先 // 深度优先
list.forEach((node: EditorNodeType) => { list.forEach((node: EditorNodeType) => {
@ -1774,7 +1771,6 @@ export class EditorManager {
patchList(this.store.root.children); patchList(this.store.root.children);
this.patching = false; this.patching = false;
this.patchingInvalid && this.patchSchema(force);
} }
/** /**

View File

@ -642,8 +642,8 @@ export const MainStore = types
return list.some(node => { return list.some(node => {
if (!node.patched && !node.isRegion) { if (!node.patched && !node.isRegion) {
return true; return true;
} else if (node.uniqueChildren.length) { } else if (node.children.length) {
return hasUnPatched(node.uniqueChildren); return hasUnPatched(node.children);
} }
return false; return false;

View File

@ -141,8 +141,7 @@ export function JSONPipeIn(
/** 脚手架构建的Schema提前构建好了组件 ID此时无需生成 ID避免破坏事件动作 */ /** 脚手架构建的Schema提前构建好了组件 ID此时无需生成 ID避免破坏事件动作 */
if ( if (
(!obj.__origin || obj.__origin !== 'scaffold') && (!obj.__origin || obj.__origin !== 'scaffold') &&
typeof obj.id === 'string' && (typeof obj.id !== 'string' || !obj.id || obj.id.startsWith('u:'))
obj.id.startsWith('u:')
) { ) {
const newId = generateNodeId(); const newId = generateNodeId();
obj.id && (idMap[obj.id] = newId); obj.id && (idMap[obj.id] = newId);