fix: duplicated designer setting items (#1028)

Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1028
This commit is contained in:
sealday 2024-05-22 01:36:55 +08:00
parent d101d5fafb
commit b338c51923
2 changed files with 3 additions and 2 deletions

View File

@ -11,7 +11,6 @@ export class SchemaSettings<T = {}> {
constructor(options: SchemaSettingOptions<T>) {
this.options = Object.assign({ items: [] }, options);
this.options.items = defaultSettingItems.concat(this.items);
this.name = options.name;
}

View File

@ -7,6 +7,7 @@ import { SchemaSettingsProps } from '../../../schema-settings';
import { Schema } from '@tachybase/schema';
import { GeneralField } from '@tachybase/schema';
import { Designable } from '../../../schema-component';
import { defaultSettingItems } from '../SchemaSettingsDefaults';
type UseSchemaSettingsRenderOptions<T = {}> = Omit<SchemaSettingOptions<T>, 'name' | 'items'> &
Omit<SchemaSettingsProps, 'title' | 'children'> & {
@ -40,8 +41,9 @@ export function useSchemaSettingsRender<T = {}>(name: string, options?: UseSchem
if (key && renderCache.current[key]) {
return renderCache.current[key];
}
const newItems = [...defaultSettingItems, ...schemaSetting.options.items];
return (renderCache.current[key] = React.createElement(SchemaSettingsWrapper, {
...schemaSetting.options,
...{ ...schemaSetting.options, items: newItems },
...options,
...options2,
}));