mirror of
https://github.com/cpvalente/ontime.git
synced 2026-07-26 10:38:55 +00:00
fix: edit custom fields with type image (#1997)
This commit is contained in:
committed by
GitHub
parent
1849b4d39f
commit
ceb490c60a
+1
@@ -39,6 +39,7 @@ export default function CustomFieldEntry(props: CustomFieldEntryProps) {
|
||||
initialColour={colour}
|
||||
initialLabel={label}
|
||||
initialKey={fieldKey}
|
||||
initialType={type}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
+3
-1
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user