Skip to content

Commit

Permalink
fix: use defaultValue in field control
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Lykesas <[email protected]>
  • Loading branch information
justlevine and alexookah committed Oct 26, 2024
1 parent 7cddbef commit f253df0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/admin/components/fields/field-control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const FieldControl = ( {
onChange,
required,
type,
value,
value: originalValue,
...rest
}: FieldControlProps ) => {
const controlType =
Expand All @@ -93,6 +93,9 @@ export const FieldControl = ( {
return null;
}

// Fallback to the default value if the value is not set.
const value = originalValue ?? rest?.default;

// Build the component props.
let componentProps: ControlComponentPropsMap[ typeof controlType ] = {
label: label || description,
Expand Down

0 comments on commit f253df0

Please sign in to comment.