忽略未定义的节点元数据补丁
保留部分更新对未提供字段的原有语义
This commit is contained in:
@@ -117,6 +117,9 @@ export function applyUiEditorCommand(
|
||||
const status = command.patch.component_status;
|
||||
if (status !== 'NoProblem') return { ok: false, reason: 'invalid' };
|
||||
}
|
||||
node.metadata = { ...node.metadata, ...structuredClone(command.patch) };
|
||||
const patch = Object.fromEntries(
|
||||
Object.entries(command.patch).filter(([, value]) => value !== undefined),
|
||||
) as Partial<NodeMetadata>;
|
||||
node.metadata = { ...node.metadata, ...structuredClone(patch) };
|
||||
return { ok: true, state: next };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user