diff --git a/packages/amis-editor-core/src/component/factory.tsx b/packages/amis-editor-core/src/component/factory.tsx index 99598bd87..408f565d6 100644 --- a/packages/amis-editor-core/src/component/factory.tsx +++ b/packages/amis-editor-core/src/component/factory.tsx @@ -20,6 +20,7 @@ import type {DataScope} from 'amis-core'; import type {RendererConfig} from 'amis-core'; import type {SchemaCollection} from 'amis'; import {SchemaFrom} from './base/SchemaForm'; +import memoize from 'lodash/memoize'; // 创建 Node Store 并构建成树 export function makeWrapper( @@ -237,6 +238,9 @@ export function makeSchemaFormRender( } ) { const env = {...manager.env, session: 'schema-form'}; + const filterBody = memoize(body => + body ? flatten(Array.isArray(body) ? body : [body]) : undefined + ); return ({value, onChange, popOverContainer, id, store, node}: PanelProps) => { const ctx = {...manager.store.ctx}; @@ -260,26 +264,17 @@ export function makeSchemaFormRender( schema.formKey ? schema.formKey : '' }`; + const body = filterBody(schema.body); + const controls = filterBody(schema.controls); + return (