Skip to content

Commit

Permalink
fix: remove unused label from AutoField type
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvxd committed Nov 7, 2024
1 parent 5df1597 commit 18b6f1a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/core/components/AutoField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,18 @@ export type FieldPropsInternal<ValueType = any, F = Field<any>> = FieldProps<

function AutoFieldInternal<
ValueType = any,
FieldType extends Field<ValueType> = Field<ValueType>
FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>
>(
props: FieldPropsInternalOptional<ValueType, FieldType> & {
Label?: React.FC<FieldLabelPropsInternal>;
}
) {
const { overrides } = useAppContext();

const { field, label = field.label, id, Label = FieldLabelInternal } = props;
const { id, Label = FieldLabelInternal } = props;

const field = props.field as Field<ValueType>;
const label = field.label;

const defaultId = useSafeId();
const resolvedId = id || defaultId;
Expand Down Expand Up @@ -189,9 +192,11 @@ function AutoFieldInternal<
// Don't let external value changes update this if it's changed manually in the last X ms
const RECENT_CHANGE_TIMEOUT = 200;

type FieldNoLabel<Props extends any = any> = Omit<Field<Props>, "label">;

export function AutoFieldPrivate<
ValueType = any,
FieldType extends Field<ValueType> = Field<ValueType>
FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>
>(
props: FieldPropsInternalOptional<ValueType, FieldType> & {
Label?: React.FC<FieldLabelPropsInternal>;
Expand Down Expand Up @@ -242,7 +247,7 @@ export function AutoFieldPrivate<

export function AutoField<
ValueType = any,
FieldType extends Field<ValueType> = Field<ValueType>
FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>
>(props: FieldProps<ValueType, FieldType>) {
const DefaultLabel = useMemo(() => {
const DefaultLabel = (labelProps: any) => (
Expand Down

0 comments on commit 18b6f1a

Please sign in to comment.