fix: edit custom fields with type image (#1997)

This commit is contained in:
Alex Christoffer Rasmussen
2026-03-08 19:31:00 +01:00
committed by GitHub
parent 1849b4d39f
commit ceb490c60a
2 changed files with 4 additions and 1 deletions
@@ -39,6 +39,7 @@ export default function CustomFieldEntry(props: CustomFieldEntryProps) {
initialColour={colour}
initialLabel={label}
initialKey={fieldKey}
initialType={type}
/>
</td>
</tr>
@@ -21,6 +21,7 @@ interface CustomFieldsFormProps {
initialColour?: string;
initialLabel?: string;
initialKey?: string;
initialType?: CustomField['type'];
}
type CustomFieldFormData = CustomField & { key: string };
@@ -31,6 +32,7 @@ export default function CustomFieldForm({
initialColour,
initialLabel,
initialKey,
initialType,
}: CustomFieldsFormProps) {
const { data } = useCustomFields();
@@ -47,7 +49,7 @@ export default function CustomFieldForm({
watch,
formState: { errors, isSubmitting, isValid, isDirty },
} = useForm<CustomFieldFormData>({
defaultValues: { type: 'text', label: initialLabel || '', colour: initialColour || '' },
defaultValues: { type: initialType ?? 'text', label: initialLabel || '', colour: initialColour || '' },
resetOptions: {
keepDirtyValues: true,
},