diff --git a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSubMenu.tsx b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSubMenu.tsx index bbbad5035a..b67ed37abe 100644 --- a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSubMenu.tsx +++ b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSubMenu.tsx @@ -72,7 +72,8 @@ export const SchemaInitializerMenu: FC = (props) => { export const SchemaInitializerSubMenu: FC = (props) => { const { children, title, name = uid(), onOpenChange, icon, ...others } = props; const compile = useCompile(); - const childrenItems = useSchemaInitializerMenuItems(children, name); + const validChildren = children?.filter((item) => (item.useVisible ? item.useVisible() : true)); + const childrenItems = useSchemaInitializerMenuItems(validChildren, name); const items = useMemo(() => { return [ diff --git a/packages/core/client/src/application/schema-settings/hooks/index.tsx b/packages/core/client/src/application/schema-settings/hooks/index.tsx index 6b2a581467..e5643ebf76 100644 --- a/packages/core/client/src/application/schema-settings/hooks/index.tsx +++ b/packages/core/client/src/application/schema-settings/hooks/index.tsx @@ -35,9 +35,9 @@ export function useSchemaSettingsRender(name: string, options?: UseSchem } return { exists: true, - render: (options2?: UseSchemaSettingsRenderOptions) => { - const key = JSON.stringify(options) || '{}'; - if (renderCache.current[key]) { + render: (options2: UseSchemaSettingsRenderOptions = {}) => { + const key = JSON.stringify(options2); + if (key && renderCache.current[key]) { return renderCache.current[key]; } return (renderCache.current[key] = React.createElement(SchemaSettingsWrapper, { diff --git a/packages/core/client/src/application/schema-settings/types.ts b/packages/core/client/src/application/schema-settings/types.ts index 89ce3a71e0..c009710838 100644 --- a/packages/core/client/src/application/schema-settings/types.ts +++ b/packages/core/client/src/application/schema-settings/types.ts @@ -40,10 +40,6 @@ export interface SchemaSettingItemGroupType extends SchemaSettingsItemCommon { - type: 'subMenu'; -} - export interface SchemaSettingItemDividerProps extends SchemaSettingsItemCommon { type: 'divider'; } @@ -76,6 +72,10 @@ export type SchemaSettingItemActionModalType = SchemaSettingsItemCommon { + type: 'subMenu'; +} + export interface SchemaSettingItemComponentType extends SchemaSettingsItemCommon { Component: string | ComponentType; } @@ -90,6 +90,7 @@ export type SchemaSettingItemAllBuiltType = | SchemaSettingItemModalType | SchemaSettingItemItemType | SchemaSettingItemSelectType + | SchemaSettingItemSubMenuType | SchemaSettingItemGroupType; export type SchemaSettingsItemType = SchemaSettingItemComponentType | SchemaSettingItemAllBuiltType;