Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesBochet committed Dec 19, 2024
1 parent 8b47d16 commit b78da0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
SettingsDataModelFieldPreviewCard,
SettingsDataModelFieldPreviewCardProps,
} from '@/settings/data-model/fields/preview/components/SettingsDataModelFieldPreviewCard';
import { useFormContext } from 'react-hook-form';

type SettingsDataModelFieldNumberSettingsFormCardProps = {
disabled?: boolean;
Expand All @@ -26,11 +27,18 @@ export const SettingsDataModelFieldNumberSettingsFormCard = ({
fieldMetadataItem,
objectMetadataItem,
}: SettingsDataModelFieldNumberSettingsFormCardProps) => {
const { watch } = useFormContext();

return (
<SettingsDataModelPreviewFormCard
preview={
<StyledFieldPreviewCard
fieldMetadataItem={fieldMetadataItem}
fieldMetadataItem={{
icon: watch('icon'),
label: watch('label') || 'New Field',
settings: watch('settings') || null,
type: fieldMetadataItem.type,
}}
objectMetadataItem={objectMetadataItem}
/>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,7 @@ export const SettingsObjectFieldEdit = () => {
/>
)}
<SettingsDataModelFieldSettingsFormCard
fieldMetadataItem={{
icon: formConfig.watch('icon'),
label: formConfig.watch('label') || 'New Field',
settings: formConfig.watch('settings') || null,
type: fieldMetadataItem.type,
}}
fieldMetadataItem={fieldMetadataItem}
objectMetadataItem={objectMetadataItem}
/>
</Section>
Expand Down

0 comments on commit b78da0c

Please sign in to comment.