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} initialColour={colour}
initialLabel={label} initialLabel={label}
initialKey={fieldKey} initialKey={fieldKey}
initialType={type}
/> />
</td> </td>
</tr> </tr>
@@ -21,6 +21,7 @@ interface CustomFieldsFormProps {
initialColour?: string; initialColour?: string;
initialLabel?: string; initialLabel?: string;
initialKey?: string; initialKey?: string;
initialType?: CustomField['type'];
} }
type CustomFieldFormData = CustomField & { key: string }; type CustomFieldFormData = CustomField & { key: string };
@@ -31,6 +32,7 @@ export default function CustomFieldForm({
initialColour, initialColour,
initialLabel, initialLabel,
initialKey, initialKey,
initialType,
}: CustomFieldsFormProps) { }: CustomFieldsFormProps) {
const { data } = useCustomFields(); const { data } = useCustomFields();
@@ -47,7 +49,7 @@ export default function CustomFieldForm({
watch, watch,
formState: { errors, isSubmitting, isValid, isDirty }, formState: { errors, isSubmitting, isValid, isDirty },
} = useForm<CustomFieldFormData>({ } = useForm<CustomFieldFormData>({
defaultValues: { type: 'text', label: initialLabel || '', colour: initialColour || '' }, defaultValues: { type: initialType ?? 'text', label: initialLabel || '', colour: initialColour || '' },
resetOptions: { resetOptions: {
keepDirtyValues: true, keepDirtyValues: true,
}, },