Skip to content
Snippets Groups Projects
Unverified Commit c021c579 authored by gabriellsh's avatar gabriellsh Committed by GitHub
Browse files

[FIX] Show custom fields of invalid type (#18794)

parent dc6bcbdb
No related merge requests found
......@@ -46,15 +46,21 @@ const CustomFieldsAssembler = ({ formValues, formHandlers, customFields, ...prop
state: formValues[key],
...value,
};
return value.type === 'text'
? <CustomTextInput {...extraProps} {...props}/>
: <CustomSelect {...extraProps} {...props}/>;
if (value.type === 'select') {
return <CustomSelect {...extraProps} {...props}/>;
}
if (value.type === 'text') {
return <CustomTextInput {...extraProps} {...props}/>;
}
return null;
});
export default function CustomFieldsForm({ customFieldsData, setCustomFieldsData, onLoadFields = () => {}, ...props }) {
const customFieldsJson = useSetting('Accounts_CustomFields');
// TODO: add deps. Left this way so that a possible change in the setting can't crash the page (useForm generates states automatically)
const [customFields] = useState(() => {
try {
return JSON.parse(customFieldsJson || '{}');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment