fix(Calendar): ensur to get correct gridInitializer when adding a new… (#1425)

* fix(Calendar): ensur to get correct gridInitializer when adding a new tab (#1241)

* perf: use useMemo
This commit is contained in:
被雨水过滤的空气-Rairn 2023-03-19 10:52:56 +08:00 committed by GitHub
parent c68caf105e
commit 9ada0e37d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 63 deletions

View File

@ -1,5 +1,5 @@
import { useForm } from '@formily/react';
import React from 'react';
import React, { useMemo } from 'react';
import { SchemaComponent, useActionContext, useDesignable, useRecordIndex } from '../..';
export const TabPaneInitializers = (props?: any) => {
@ -46,9 +46,8 @@ export const TabPaneInitializers = (props?: any) => {
},
};
};
return (
<SchemaComponent
schema={{
const schema = useMemo(() => {
return {
type: 'void',
properties: {
action1: {
@ -117,9 +116,9 @@ export const TabPaneInitializers = (props?: any) => {
},
},
},
}}
/>
);
};
}, []);
return <SchemaComponent schema={schema} />;
};
export const TabPaneInitializersForCreateFormBlock = (props) => {

View File

@ -1008,6 +1008,9 @@ export const createCalendarBlockSchema = (options) => {
'x-component': 'Tabs',
'x-component-props': {},
'x-initializer': 'TabPaneInitializers',
'x-initializer-props': {
gridInitializer: 'RecordBlockInitializers',
},
properties: {
tab1: {
type: 'void',