fix: pop up errors after save as template (#6840)

This commit is contained in:
gchust
2025-05-12 17:10:03 +08:00
committed by GitHub
parent 20c33c934d
commit 1154d376ca
2 changed files with 6 additions and 0 deletions
@@ -190,6 +190,9 @@ function cleanSchema(schema?: any) {
if (schema.properties[key]['x-component'] == null && shouldDeleteNoComponentSchema(schema.properties[key])) {
delete schema.properties[key];
}
if (properties[key]?.['x-component-props'] === null) {
delete properties[key]['x-component-props'];
}
// 如果x-component是Grid.Row,且内部无任何内容,则删除
if (properties[key]?.['x-component'] === 'Grid.Row') {
let hasProperties = false;
@@ -400,6 +400,9 @@ export function cleanSchema(schema?: Schema, templateId?: string) {
if (schema.properties[key]['x-template-root-uid'] && schema.properties[key]['x-template-root-uid'] !== templateId) {
continue;
}
if (properties[key]?.['x-component-props'] === null) {
delete properties[key]['x-component-props'];
}
if (properties[key]?.['x-component'] === 'Grid.Row') {
let hasProperties = false;
const cols = Object.values(properties[key]?.['properties'] || {});