refactor(CollectionFieldInternalField): remove useless code

This commit is contained in:
Zeke Zhang 2024-10-31 08:49:30 +08:00
parent 2e06a04f73
commit 38320fe489

View File

@ -9,7 +9,6 @@
import { Field } from '@formily/core'; import { Field } from '@formily/core';
import { connect, Schema, useField, useFieldSchema } from '@formily/react'; import { connect, Schema, useField, useFieldSchema } from '@formily/react';
import { untracked } from '@formily/reactive';
import { merge } from '@formily/shared'; import { merge } from '@formily/shared';
import { concat } from 'lodash'; import { concat } from 'lodash';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
@ -24,11 +23,9 @@ type Props = {
}; };
const setFieldProps = (field: Field, key: string, value: any) => { const setFieldProps = (field: Field, key: string, value: any) => {
untracked(() => {
if (field[key] === undefined) { if (field[key] === undefined) {
field[key] = value; field[key] = value;
} }
});
}; };
const setRequired = (field: Field, fieldSchema: Schema, uiSchema: Schema) => { const setRequired = (field: Field, fieldSchema: Schema, uiSchema: Schema) => {
@ -78,7 +75,7 @@ export const CollectionFieldInternalField: React.FC = (props: Props) => {
setRequired(field, fieldSchema, uiSchema); setRequired(field, fieldSchema, uiSchema);
// @ts-ignore // @ts-ignore
field.dataSource = uiSchema.enum; field.dataSource = uiSchema.enum;
const originalProps = compile(uiSchema['x-component-props']) || {}; const originalProps = uiSchema['x-component-props'] || {};
field.componentProps = merge(originalProps, field.componentProps || {}, dynamicProps || {}); field.componentProps = merge(originalProps, field.componentProps || {}, dynamicProps || {});
}, [uiSchemaOrigin]); }, [uiSchemaOrigin]);